1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[LoopFlatten] Use Loop to identify loop induction phi. NFC

Replace code which identifies induction phi with helper function
getInductionVariable to improve robustness.

Differential Revision: https://reviews.llvm.org/D106045
This commit is contained in:
Rosie Sumpter 2021-07-15 08:51:30 +01:00
parent fa9e7701df
commit 839ef97cbf

View File

@ -124,19 +124,12 @@ static bool findLoopComponents(
// Find the induction PHI. If there is no induction PHI, we can't do the
// transformation. TODO: could other variables trigger this? Do we have to
// search for the best one?
InductionPHI = nullptr;
for (PHINode &PHI : L->getHeader()->phis()) {
InductionDescriptor ID;
if (InductionDescriptor::isInductionPHI(&PHI, L, SE, ID)) {
InductionPHI = Φ
LLVM_DEBUG(dbgs() << "Found induction PHI: "; InductionPHI->dump());
break;
}
}
InductionPHI = L->getInductionVariable(*SE);
if (!InductionPHI) {
LLVM_DEBUG(dbgs() << "Could not find induction PHI\n");
return false;
}
LLVM_DEBUG(dbgs() << "Found induction PHI: "; InductionPHI->dump());
auto IsValidPredicate = [&](ICmpInst::Predicate Pred) {
if (ContinueOnTrue)