diff options
author | Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com> | 2024-12-13 14:18:33 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-13 14:18:33 +0000 |
commit | 4a0d53a0b0a58a3c6980a7c551357ac71ba3db10 (patch) | |
tree | ce56a6aab6c39c04d1f9b40cb2061c0f312e65cc /llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | |
parent | 89f1f32bff76c8cf4545ada34663c6a758214cf0 (diff) | |
download | llvm-4a0d53a0b0a58a3c6980a7c551357ac71ba3db10.zip llvm-4a0d53a0b0a58a3c6980a7c551357ac71ba3db10.tar.gz llvm-4a0d53a0b0a58a3c6980a7c551357ac71ba3db10.tar.bz2 |
PatternMatch: migrate to CmpPredicate (#118534)
With the introduction of CmpPredicate in 51a895a (IR: introduce struct
with CmpInst::Predicate and samesign), PatternMatch is one of the first
key pieces of infrastructure that must be updated to match a CmpInst
respecting samesign information. Implement this change to Cmp-matchers.
This is a preparatory step in migrating the codebase over to
CmpPredicate. Since we no functional changes are desired at this stage,
we have chosen not to migrate CmpPredicate::operator==(CmpPredicate)
calls to use CmpPredicate::getMatching(), as that would have visible
impact on tests that are not yet written: instead, we call
CmpPredicate::operator==(Predicate), preserving the old behavior, while
also inserting a few FIXME comments for follow-ups.
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyIndVar.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp index 7fca1a6..f05d32d 100644 --- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp @@ -2164,16 +2164,14 @@ void WidenIV::calculatePostIncRange(Instruction *NarrowDef, !NarrowDefRHS->isNonNegative()) return; - auto UpdateRangeFromCondition = [&] (Value *Condition, - bool TrueDest) { - CmpInst::Predicate Pred; + auto UpdateRangeFromCondition = [&](Value *Condition, bool TrueDest) { + CmpPredicate Pred; Value *CmpRHS; if (!match(Condition, m_ICmp(Pred, m_Specific(NarrowDefLHS), m_Value(CmpRHS)))) return; - CmpInst::Predicate P = - TrueDest ? Pred : CmpInst::getInversePredicate(Pred); + CmpPredicate P = TrueDest ? Pred : ICmpInst::getInverseCmpPredicate(Pred); auto CmpRHSRange = SE->getSignedRange(SE->getSCEV(CmpRHS)); auto CmpConstrainedLHSRange = |