[PATCH] D29729: [InstCombine] don't lose nsw/nuw from add by converting to xor

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 18 14:23:36 PST 2017


spatel added inline comments.


================
Comment at: test/Transforms/InstCombine/add.ll:252
 ; CHECK-LABEL: @test20(
-; CHECK-NEXT:    ret i32 %x
+; CHECK-NEXT:    [[Z:%.*]] = or i32 %x, -2147483648
+; CHECK-NEXT:    ret i32 [[Z]]
----------------
spatel wrote:
> sanjoy wrote:
> > Can we add a simple peephole to not regress this case?  I.e.  `(xor SIGN_BIT (add nsw X SIGN_BIT))` to `X`?
> > 
> > (I'm fine doing that in an immediately following change and not in this change specifically).
> Sure - I didn't know if combining those 2 steps into 1 patch would be welcome, but it makes sense to not introduce a known regression.
rL295573


https://reviews.llvm.org/D29729





More information about the llvm-commits mailing list