[PATCH] D50301: [InstCombine] De Morgan: sink 'not' into 'xor' (PR38446)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 7 10:26:48 PDT 2018


spatel added inline comments.


================
Comment at: test/Transforms/InstCombine/demorgan-sink-not-into-xor.ll:37-49
 define i1 @positive_easyinvert(i8 %y) {
 ; CHECK-LABEL: @positive_easyinvert(
 ; CHECK-NEXT:    [[TMP1:%.*]] = call i1 @gen1()
-; CHECK-NEXT:    [[TMP2:%.*]] = icmp slt i8 [[Y:%.*]], 0
-; CHECK-NEXT:    [[TMP3:%.*]] = xor i1 [[TMP1]], [[TMP2]]
-; CHECK-NEXT:    [[TMP4:%.*]] = xor i1 [[TMP3]], true
+; CHECK-NEXT:    [[TMP2:%.*]] = icmp sgt i8 [[Y:%.*]], -1
+; CHECK-NEXT:    [[TMP4:%.*]] = xor i1 [[TMP1]], [[TMP2]]
 ; CHECK-NEXT:    ret i1 [[TMP4]]
 ;
----------------
lebedev.ri wrote:
> I don't know about the other cases, but do you agree that this is an improvement?
> This is the motivational case here, the only one i care about here.
Yes, that's obviously better since it folds the 'not' into the cmp. If you want to limit the transform, so we just get that case, that works for me. We can open the can of worms another day. :)


Repository:
  rL LLVM

https://reviews.llvm.org/D50301





More information about the llvm-commits mailing list