aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
diff options
context:
space:
mode:
authorRamkumar Ramachandra <ramkumar.ramachandra@codasip.com>2025-01-31 18:07:44 +0000
committerGitHub <noreply@github.com>2025-01-31 18:07:44 +0000
commit88f858d85837dd342f49f25c87ab42837afd5799 (patch)
tree15751292395515d229bb916977a19140977df4dc /llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
parent759ef5811e2297f2cbe7578f7c118668e3467c6a (diff)
downloadllvm-88f858d85837dd342f49f25c87ab42837afd5799.zip
llvm-88f858d85837dd342f49f25c87ab42837afd5799.tar.gz
llvm-88f858d85837dd342f49f25c87ab42837afd5799.tar.bz2
IndVarSimplify: thread CmpPredicate to SCEV (NFC) (#125240)
Relevant parts of ScalarEvolution's API accept a CmpPredicate instead of a CmpInst::Predicate after 60dc450 (SCEV: migrate to CmpPredicate (NFC)). After auditing the callers of these APIs, it was found that IndVarSimplify was dropping samesign information. Fix this.
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyIndVar.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyIndVar.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index f05d32d..e41a1ad 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -205,12 +205,12 @@ bool SimplifyIndvar::makeIVComparisonInvariant(ICmpInst *ICmp,
if (!Preheader)
return false;
unsigned IVOperIdx = 0;
- ICmpInst::Predicate Pred = ICmp->getPredicate();
+ CmpPredicate Pred = ICmp->getCmpPredicate();
if (IVOperand != ICmp->getOperand(0)) {
// Swapped
assert(IVOperand == ICmp->getOperand(1) && "Can't find IVOperand");
IVOperIdx = 1;
- Pred = ICmpInst::getSwappedPredicate(Pred);
+ Pred = ICmpInst::getSwappedCmpPredicate(Pred);
}
// Get the SCEVs for the ICmp operands (in the specific context of the
@@ -249,13 +249,13 @@ bool SimplifyIndvar::makeIVComparisonInvariant(ICmpInst *ICmp,
void SimplifyIndvar::eliminateIVComparison(ICmpInst *ICmp,
Instruction *IVOperand) {
unsigned IVOperIdx = 0;
- ICmpInst::Predicate Pred = ICmp->getPredicate();
+ CmpPredicate Pred = ICmp->getCmpPredicate();
ICmpInst::Predicate OriginalPred = Pred;
if (IVOperand != ICmp->getOperand(0)) {
// Swapped
assert(IVOperand == ICmp->getOperand(1) && "Can't find IVOperand");
IVOperIdx = 1;
- Pred = ICmpInst::getSwappedPredicate(Pred);
+ Pred = ICmpInst::getSwappedCmpPredicate(Pred);
}
// Get the SCEVs for the ICmp operands (in the specific context of the