[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:49:57 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>
----------------
craig.topper wrote:
> 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.
h oops. I thought you were asking about the other vector tests, not this one. I believe the scalar matching code uses CosntantInt. I can submit another patch to fix it too.


https://reviews.llvm.org/D36498





More information about the llvm-commits mailing list