[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:57 PDT 2026
================
@@ -806,14 +815,13 @@ foldAndOrOfICmpsWithPow2AndWithZero(InstCombiner::BuilderTy &Builder,
// be one-use. We don't create additional instructions if only one
// of them is one-use. So cases where one is one-use and the other
// is two-use might be profitable.
- if (!match(LHS, m_OneUse(m_ICmp(Pred, m_Value(Op), m_Zero()))) ||
- !match(RHS, m_OneUse(m_c_ICmp(Pred, m_Specific(Op), m_Value(Pow2)))) ||
- match(Pow2, m_One()) ||
- !isKnownToBeAPowerOfTwo(Pow2, Q.DL, /*OrZero=*/true, Q.AC, Q.CxtI, Q.DT))
+ if (!LHSOneUse || !RHSOneUse || !match(LHS1, m_Zero()) || RHS0 != LHS0 ||
+ match(RHS1, m_One()) ||
+ !isKnownToBeAPowerOfTwo(RHS1, Q.DL, /*OrZero=*/true, Q.AC, Q.CxtI, Q.DT))
----------------
dtcxzyw wrote:
isKnownToBeAPowerOfTwo supports passing SQ directly.
https://github.com/llvm/llvm-project/pull/221555
More information about the llvm-commits
mailing list