[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:04:59 PDT 2018


spatel added a comment.

I may be starting a substantial yak shaving with the inline question, but I wonder if it wouldn't be better to canonicalize with the 'not' after the 'xor' (ie, the inverse of this patch). I don't have a motivating example yet, but that just seems more natural rather than semi-arbitralily choosing an operand to invert.



================
Comment at: test/Transforms/InstCombine/set.ll:132-137
 ; CHECK-LABEL: @test14(
-; CHECK-NEXT:    [[TMP1:%.*]] = xor i1 [[A:%.*]], [[B:%.*]]
-; CHECK-NEXT:    [[C:%.*]] = xor i1 [[TMP1]], true
+; CHECK-NEXT:    [[A_NOT:%.*]] = xor i1 [[A:%.*]], true
+; CHECK-NEXT:    [[C:%.*]] = xor i1 [[A_NOT]], [[B:%.*]]
 ; CHECK-NEXT:    ret i1 [[C]]
 ;
   %C = icmp eq i1 %A, %B
----------------
I don't see any value in this transform (either to the old version or the new).
Can we refine the existing canonicalization to avoid this?
(This may raise questions about whether the existing general canonicalizations are actually opposite of what they should be?)


Repository:
  rL LLVM

https://reviews.llvm.org/D50301





More information about the llvm-commits mailing list