[PATCH] D36498: [InstCombine] Teach foldSelectICmpAnd to recognize a (icmp slt trunc X, 0) and (icmp sgt trunc X, -1) as equivalent to an and with the sign bit of the truncated type

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 15 14:32:30 PDT 2017


craig.topper added inline comments.


================
Comment at: test/Transforms/InstCombine/select-with-bitwise-ops.ll:496-498
+; CHECK-NEXT:    [[TMP1:%.*]] = lshr <2 x i32> [[X:%.*]], <i32 30, i32 30>
+; CHECK-NEXT:    [[TMP2:%.*]] = and <2 x i32> [[TMP1]], <i32 2, i32 2>
+; CHECK-NEXT:    [[TMP3:%.*]] = xor <2 x i32> [[TMP2]], <i32 42, i32 42>
----------------
spatel wrote:
> This is miscompiling:
> http://rise4fun.com/Alive/ACO
> 
> Should be the same ops as the scalar test?
Yeah it should, but it isn't. See the child revision of this D36763.


https://reviews.llvm.org/D36498





More information about the llvm-commits mailing list