[llvm] [InstCombine] Add transforms `(icmp spred (and X, Y), X)` if `X` or `Y` are known signed/unsigned (PR #94417)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 5 10:58:25 PDT 2024
================
@@ -4745,6 +4745,40 @@ static Instruction *foldICmpAndXX(ICmpInst &I, const SimplifyQuery &Q,
Constant::getNullValue(Op1->getType()));
}
+ if (!ICmpInst::isSigned(Pred))
+ return nullptr;
+
+ KnownBits KnownY = IC.computeKnownBits(A, /*Depth=*/0, &I);
+ // (X & NegY) spred X --> (X & NegY) upred X
+ if (KnownY.isNegative())
----------------
dtcxzyw wrote:
Can you double check that all cases are covered by existing tests?
https://github.com/llvm/llvm-project/pull/94417
More information about the llvm-commits
mailing list