[llvm] 6f807ca - [NFC][InstCombine] Add shift amount reassociation in bittest miscompile example from PR44802
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 25 07:25:17 PST 2020
Author: Roman Lebedev
Date: 2020-02-25T18:23:58+03:00
New Revision: 6f807ca00d951d3e74f7ea4fe1daa8e3560f4c0d
URL: https://github.com/llvm/llvm-project/commit/6f807ca00d951d3e74f7ea4fe1daa8e3560f4c0d
DIFF: https://github.com/llvm/llvm-project/commit/6f807ca00d951d3e74f7ea4fe1daa8e3560f4c0d.diff
LOG: [NFC][InstCombine] Add shift amount reassociation in bittest miscompile example from PR44802
https://bugs.llvm.org/show_bug.cgi?id=44802
Added:
Modified:
llvm/test/Transforms/InstCombine/shift-amount-reassociation-in-bittest.ll
Removed:
################################################################################
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 27224705929c..0386d8042f92 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
+}
More information about the llvm-commits
mailing list