Skip to content
Snippets Groups Projects
Commit 9b4d37e8 authored by Duncan P. N. Exon Smith's avatar Duncan P. N. Exon Smith
Browse files

LoopUnroll: Only check for ScalarEvolution analysis once, NFC

A follow-up commit will add use to a tight loop.  We might as well just
find it once anyway.

llvm-svn: 219239
parent 2b8baaa5
No related branches found
No related tags found
No related merge requests found
...@@ -224,11 +224,10 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, ...@@ -224,11 +224,10 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
// Notify ScalarEvolution that the loop will be substantially changed, // Notify ScalarEvolution that the loop will be substantially changed,
// if not outright eliminated. // if not outright eliminated.
if (PP) { ScalarEvolution *SE =
ScalarEvolution *SE = PP->getAnalysisIfAvailable<ScalarEvolution>(); PP ? PP->getAnalysisIfAvailable<ScalarEvolution>() : nullptr;
if (SE) if (SE)
SE->forgetLoop(L); SE->forgetLoop(L);
}
// If we know the trip count, we know the multiple... // If we know the trip count, we know the multiple...
unsigned BreakoutTrip = 0; unsigned BreakoutTrip = 0;
...@@ -459,7 +458,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, ...@@ -459,7 +458,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
} }
// Simplify any new induction variables in the partially unrolled loop. // Simplify any new induction variables in the partially unrolled loop.
ScalarEvolution *SE = PP->getAnalysisIfAvailable<ScalarEvolution>();
if (SE && !CompletelyUnroll) { if (SE && !CompletelyUnroll) {
SmallVector<WeakVH, 16> DeadInsts; SmallVector<WeakVH, 16> DeadInsts;
simplifyLoopIVs(L, SE, LPM, DeadInsts); simplifyLoopIVs(L, SE, LPM, DeadInsts);
...@@ -508,7 +506,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, ...@@ -508,7 +506,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
if (OuterL) { if (OuterL) {
DataLayoutPass *DLP = PP->getAnalysisIfAvailable<DataLayoutPass>(); DataLayoutPass *DLP = PP->getAnalysisIfAvailable<DataLayoutPass>();
const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr; const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr;
ScalarEvolution *SE = PP->getAnalysisIfAvailable<ScalarEvolution>();
simplifyLoop(OuterL, DT, LI, PP, /*AliasAnalysis*/ nullptr, SE, DL, AT); simplifyLoop(OuterL, DT, LI, PP, /*AliasAnalysis*/ nullptr, SE, DL, AT);
// LCSSA must be performed on the outermost affected loop. The unrolled // LCSSA must be performed on the outermost affected loop. The unrolled
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment