diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2020-02-25 16:06:13 +0300 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2020-02-27 13:45:21 +0100 |
commit | 77e448c0d3a87e7944381d7d53e55c997c8b936a (patch) | |
tree | fb70cfbec74f2988290e534761def87ec1b7b6c9 | |
parent | 3b6f4c544be48dcfa663cfb62da3fd4e779954a5 (diff) | |
download | bcm5719-llvm-77e448c0d3a87e7944381d7d53e55c997c8b936a.tar.gz bcm5719-llvm-77e448c0d3a87e7944381d7d53e55c997c8b936a.zip |
[NFC][InstCombine] Add shift amount reassociation miscompile example from PR44802
https://bugs.llvm.org/show_bug.cgi?id=44802
(cherry picked from commit 425ef999385058143bb927aefe81daddcd43f623)
-rw-r--r-- | llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll b/llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll index 6e54133bacc..0b8187d0417 100644 --- a/llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll +++ b/llvm/test/Transforms/InstCombine/shift-amount-reassociation.ll @@ -319,3 +319,18 @@ define i32 @n20(i32 %x, i32 %y) { %t3 = shl i32 %t1, %t2 ret i32 %t3 } + +; FIXME: this is a miscompile. We should not transform this. +; See https://bugs.llvm.org/show_bug.cgi?id=44802 +define i3 @pr44802(i3 %t0) { +; CHECK-LABEL: @pr44802( +; CHECK-NEXT: [[T1:%.*]] = sub i3 0, [[T0:%.*]] +; CHECK-NEXT: ret i3 [[T1]] +; + %t1 = sub i3 0, %t0 + %t2 = icmp ne i3 %t0, 0 + %t3 = zext i1 %t2 to i3 + %t4 = lshr i3 %t1, %t3 + %t5 = lshr i3 %t4, %t3 + ret i3 %t5 +} |