[llvm] [InstCombine] Prepare to support trunc nuw condition in foldAndOrOfICmps (NFC) (PR #221555)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 11:45:59 PDT 2026


================
@@ -3628,7 +3664,7 @@ Value *InstCombinerImpl::foldAndOrOfICmps(ICmpInst *LHS, ICmpInst *RHS,
   // (X & ExpMask) == 0 || (X & ExpMask) == ExpMask -> !isnormal(X)
   Value *X;
   const APInt *MaskC;
-  if (LHS0 == RHS0 && PredL == PredR &&
+  if (LHS0 == RHS0 && PredL.dropSameSign() == PredR.dropSameSign() &&
       PredL == (IsAnd ? ICmpInst::ICMP_NE : ICmpInst::ICMP_EQ) &&
       !I.getFunction()->hasFnAttribute(Attribute::NoImplicitFloat) &&
       LHS->hasOneUse() && RHS->hasOneUse() &&
----------------
dtcxzyw wrote:

LHSOneUse && RHSOneUse

https://github.com/llvm/llvm-project/pull/221555


More information about the llvm-commits mailing list