[llvm] [InstCombine] Decompose more icmps into masks (PR #110836)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 2 21:01:56 PDT 2024
================
@@ -5919,29 +5919,14 @@ Instruction *InstCombinerImpl::foldICmpWithTrunc(ICmpInst &ICmp) {
// This matches patterns corresponding to tests of the signbit as well as:
// (trunc X) u< C --> (X & -C) == 0 (are all masked-high-bits clear?)
// (trunc X) u> C --> (X & ~C) != 0 (are any masked-high-bits set?)
- if (auto Res = decomposeBitTestICmp(Op0, Op1, Pred, /*WithTrunc=*/true)) {
+ if (auto Res = decomposeBitTestICmp(Op0, Op1, Pred, /*WithTrunc=*/true,
+ /*AllowNonZeroC=*/true)) {
Value *And = Builder.CreateAnd(Res->X, Res->Mask);
- Constant *Zero = ConstantInt::getNullValue(Res->X->getType());
+ Constant *Zero = ConstantInt::get(Res->X->getType(), Res->C);
----------------
dtcxzyw wrote:
Should update the comment and this variable name.
https://github.com/llvm/llvm-project/pull/110836
More information about the llvm-commits
mailing list