diff options
author | Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com> | 2025-01-12 15:19:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-12 15:19:29 +0000 |
commit | 66badf224ade6e78d5da005f6a9819092fd8767b (patch) | |
tree | 1dbc533b6906821d87d37dbb0e39cca892824947 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 26b4a0ac7ed3f04f10bd1c043e2cf9c52da7fc47 (diff) | |
download | llvm-66badf224ade6e78d5da005f6a9819092fd8767b.zip llvm-66badf224ade6e78d5da005f6a9819092fd8767b.tar.gz llvm-66badf224ade6e78d5da005f6a9819092fd8767b.tar.bz2 |
VT: teach a special-case optz about samesign (#122590)
There is a narrow special-case in isImpliedCondICmps that can benefit
from being taught about samesign. Since it costs us nothing to implement
it, teach it about samesign, for completeness. This patch marks the
completion of the effort to teach ValueTracking about samesign.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 53da8d2..0e50fc6 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -9495,7 +9495,8 @@ isImpliedCondICmps(const ICmpInst *LHS, CmpPredicate RPred, const Value *R0, // must be positive if X >= Y and no overflow". // Take SGT as an example: L0:x > L1:y and C >= 0 // ==> R0:(x -nsw y) < R1:(-C) is false - if ((LPred == ICmpInst::ICMP_SGT || LPred == ICmpInst::ICMP_SGE) && + if ((CmpPredicate::getMatching(LPred, ICmpInst::ICMP_SGT) || + CmpPredicate::getMatching(LPred, ICmpInst::ICMP_SGE)) && match(R0, m_NSWSub(m_Specific(L0), m_Specific(L1)))) { if (match(R1, m_NonPositive()) && isImpliedCondMatchingOperands(LPred, RPred) == false) @@ -9504,7 +9505,8 @@ isImpliedCondICmps(const ICmpInst *LHS, CmpPredicate RPred, const Value *R0, // Take SLT as an example: L0:x < L1:y and C <= 0 // ==> R0:(x -nsw y) < R1:(-C) is true - if ((LPred == ICmpInst::ICMP_SLT || LPred == ICmpInst::ICMP_SLE) && + if ((CmpPredicate::getMatching(LPred, ICmpInst::ICMP_SLT) || + CmpPredicate::getMatching(LPred, ICmpInst::ICMP_SLE)) && match(R0, m_NSWSub(m_Specific(L0), m_Specific(L1)))) { if (match(R1, m_NonNegative()) && isImpliedCondMatchingOperands(LPred, RPred) == true) |