diff --git a/lib/Transforms/Utils/LoopUnroll.cpp b/lib/Transforms/Utils/LoopUnroll.cpp index fbfebc3a8dc..b1cc76859e9 100644 --- a/lib/Transforms/Utils/LoopUnroll.cpp +++ b/lib/Transforms/Utils/LoopUnroll.cpp @@ -224,11 +224,10 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, // Notify ScalarEvolution that the loop will be substantially changed, // if not outright eliminated. - if (PP) { - ScalarEvolution *SE = PP->getAnalysisIfAvailable(); - if (SE) - SE->forgetLoop(L); - } + ScalarEvolution *SE = + PP ? PP->getAnalysisIfAvailable() : nullptr; + if (SE) + SE->forgetLoop(L); // If we know the trip count, we know the multiple... unsigned BreakoutTrip = 0; @@ -459,7 +458,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, } // Simplify any new induction variables in the partially unrolled loop. - ScalarEvolution *SE = PP->getAnalysisIfAvailable(); if (SE && !CompletelyUnroll) { SmallVector DeadInsts; simplifyLoopIVs(L, SE, LPM, DeadInsts); @@ -508,7 +506,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, if (OuterL) { DataLayoutPass *DLP = PP->getAnalysisIfAvailable(); const DataLayout *DL = DLP ? &DLP->getDataLayout() : nullptr; - ScalarEvolution *SE = PP->getAnalysisIfAvailable(); simplifyLoop(OuterL, DT, LI, PP, /*AliasAnalysis*/ nullptr, SE, DL, AT); // LCSSA must be performed on the outermost affected loop. The unrolled