[PATCH] D49954: [InstCombine] Fold Select with binary op

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 28 08:22:42 PDT 2018


spatel added inline comments.


================
Comment at: test/Transforms/InstCombine/select-binop-icmp.ll:18-26
+define i32 @select_mul_icmp(i32 %x, i32 %y, i32 %z) {
+; CHECK-LABEL: @select_mul_icmp(
+; CHECK-NEXT:    [[A:%.*]] = icmp eq i32 [[X:%.*]], 0
+; CHECK-NEXT:    [[TMP1:%.*]] = select i1 [[A]], i32 [[Z:%.*]], i32 [[Y:%.*]]
+; CHECK-NEXT:    ret i32 [[TMP1]]
+;
+  %A = icmp eq i32 %x, 0
----------------
That's a miscompile:
https://rise4fun.com/Alive/9SC

The identity constant needs to match the compare constant.


https://reviews.llvm.org/D49954





More information about the llvm-commits mailing list