[PATCH] D45867: [InstCombine] Unfold masked merge with constant mask
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 30 07:49:20 PDT 2018
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM - see inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2421-2423
+/// If A has one use, we want to canonicalize it to non-inverted mask:
/// ((x ^ y) & M) ^ x
+/// * If the M is constant, and A has one use, we want to unfold it:
----------------
We should state our reasoning here - because I know I won't remember for long. :)
So something like:
We can canonicalize by swapping the final xor operand to eliminate the 'not' of the mask.
If M is a constant, we transform to 'and' / 'or' ops because that shortens the dependency chain and improves analysis.
================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2447
+ Value *LHS = Builder.CreateAnd(X, C);
+ Value *iC = Builder.CreateNot(C);
+ Value *RHS = Builder.CreateAnd(B, iC);
----------------
iC -> NotC
Repository:
rL LLVM
https://reviews.llvm.org/D45867
More information about the llvm-commits
mailing list