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

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 23:43:33 PST 2017


sanjoy 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]]
----------------
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).


================
Comment at: test/Transforms/InstCombine/icmp-add.ll:226
 
-; FIXME: InstCombine should not lose wrapping information by changing the add to xor.
+; InstCombine should not thwart this opportunity to simplify completely.
 
----------------
Why not just delete the comment?


https://reviews.llvm.org/D29729





More information about the llvm-commits mailing list