summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2020-02-25 17:14:43 +0300
committerHans Wennborg <hans@chromium.org>2020-02-27 13:45:21 +0100
commitac293ede5e62cfc569f2d5d8f4667e6188afced0 (patch)
tree9569954a8453a7af1e98f9283da7d8ac386da131
parentf115a88191c3dc80c5140fbbf63f74ca77fcc74b (diff)
downloadbcm5719-llvm-ac293ede5e62cfc569f2d5d8f4667e6188afced0.tar.gz
bcm5719-llvm-ac293ede5e62cfc569f2d5d8f4667e6188afced0.zip
[NFC][InstCombine] Add shift amount reassociation in bittest miscompile example from PR44802
https://bugs.llvm.org/show_bug.cgi?id=44802 (cherry picked from commit 6f807ca00d951d3e74f7ea4fe1daa8e3560f4c0d)
-rw-r--r--llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll b/llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll
index 27224705929..0386d8042f9 100644
--- a/llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll
+++ b/llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll
@@ -687,3 +687,20 @@ entry:
%tobool = icmp ne i16 %and, 0
ret i1 %tobool
}
+
+; FIXME: this is a miscompile. We should not transform this.
+; See https://bugs.llvm.org/show_bug.cgi?id=44802
+define i1 @pr44802(i3 %a, i3 %x, i3 %y) {
+; CHECK-LABEL: @pr44802(
+; CHECK-NEXT: [[TMP1:%.*]] = and i3 [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i3 [[TMP1]], 0
+; CHECK-NEXT: ret i1 [[TMP2]]
+;
+ %t0 = icmp ne i3 %a, 0
+ %t1 = zext i1 %t0 to i3
+ %t2 = lshr i3 %x, %t1
+ %t3 = shl i3 %y, %t1
+ %t4 = and i3 %t2, %t3
+ %t5 = icmp ne i3 %t4, 0
+ ret i1 %t5
+}
OpenPOWER on IntegriCloud