[PATCH] D34230: [InstCombine] Handle (iszero(A & K1) | iszero(A & K2)) -> (A & (K1 | K2)) != (K1 | K2) when the one of the Ands is commuted relative to the other

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 10:31:43 PDT 2017


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

LGTM. See inline for a possible follow-up and nit.



================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1599-1603
   ConstantInt *LHSC = dyn_cast<ConstantInt>(LHS->getOperand(1));
   ConstantInt *RHSC = dyn_cast<ConstantInt>(RHS->getOperand(1));
 
   if (LHS->getPredicate() == ICmpInst::ICMP_EQ && LHSC && LHSC->isZero() &&
       RHS->getPredicate() == ICmpInst::ICMP_EQ && RHSC && RHSC->isZero()) {
----------------
Could turn this into a matcher too; using m_Zero() would work with vectors.


================
Comment at: test/Transforms/InstCombine/onehot_merge.ll:49
 ;
 bb:
   %k2 = mul i32 %k, %k ; to trick the complexity sorting
----------------
Remove the label to minimize?


https://reviews.llvm.org/D34230





More information about the llvm-commits mailing list