Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1262,14 +1262,14 @@ static std::optional<Value *>
createReplacement(ICmpInst *ICmp, const Loop *L, BasicBlock *ExitingBB,
const SCEV *MaxIter, bool Inverted, bool SkipLastIter,
ScalarEvolution *SE, SCEVExpander &Rewriter) {
ICmpInst::Predicate Pred = ICmp->getPredicate();
CmpPredicate Pred = ICmp->getCmpPredicate();
Value *LHS = ICmp->getOperand(0);
Value *RHS = ICmp->getOperand(1);

// 'LHS pred RHS' should now mean that we stay in loop.
auto *BI = cast<BranchInst>(ExitingBB->getTerminator());
if (Inverted)
Pred = CmpInst::getInversePredicate(Pred);
Pred = ICmpInst::getInverseCmpPredicate(Pred);

const SCEV *LHSS = SE->getSCEVAtScope(LHS, L);
const SCEV *RHSS = SE->getSCEVAtScope(RHS, L);
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down