[LIR] Handle the LoopInfo the same as all the other analyses. No utility
authorChandler Carruth <chandlerc@gmail.com>
Thu, 13 Aug 2015 09:27:01 +0000 (09:27 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 13 Aug 2015 09:27:01 +0000 (09:27 +0000)
really in breaking pattern just for this analysis.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244878 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopIdiomRecognize.cpp

index e431609c47461cf33e59ec952e59b5b11b7354e5..e3fe2530c2b8e5d61878b3531eeea115070b62a3 100644 (file)
@@ -70,6 +70,7 @@ namespace {
 class LoopIdiomRecognize : public LoopPass {
   Loop *CurLoop;
   DominatorTree *DT;
 class LoopIdiomRecognize : public LoopPass {
   Loop *CurLoop;
   DominatorTree *DT;
+  LoopInfo *LI;
   ScalarEvolution *SE;
   TargetLibraryInfo *TLI;
   const TargetTransformInfo *TTI;
   ScalarEvolution *SE;
   TargetLibraryInfo *TLI;
   const TargetTransformInfo *TTI;
@@ -188,6 +189,7 @@ bool LoopIdiomRecognize::runOnLoop(Loop *L, LPPassManager &LPM) {
     return false;
 
   DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
     return false;
 
   DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
+  LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
   SE = &getAnalysis<ScalarEvolution>();
   TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
   TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
   SE = &getAnalysis<ScalarEvolution>();
   TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
   TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(
@@ -211,8 +213,6 @@ bool LoopIdiomRecognize::runOnCountableLoop() {
     if (BECst->getValue()->getValue() == 0)
       return false;
 
     if (BECst->getValue()->getValue() == 0)
       return false;
 
-  LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
-
   SmallVector<BasicBlock *, 8> ExitBlocks;
   CurLoop->getUniqueExitBlocks(ExitBlocks);
 
   SmallVector<BasicBlock *, 8> ExitBlocks;
   CurLoop->getUniqueExitBlocks(ExitBlocks);
 
@@ -224,7 +224,7 @@ bool LoopIdiomRecognize::runOnCountableLoop() {
   // Scan all the blocks in the loop that are not in subloops.
   for (auto *BB : CurLoop->getBlocks()) {
     // Ignore blocks in subloops.
   // Scan all the blocks in the loop that are not in subloops.
   for (auto *BB : CurLoop->getBlocks()) {
     // Ignore blocks in subloops.
-    if (LI.getLoopFor(BB) != CurLoop)
+    if (LI->getLoopFor(BB) != CurLoop)
       continue;
 
     MadeChange |= runOnLoopBlock(BB, BECount, ExitBlocks);
       continue;
 
     MadeChange |= runOnLoopBlock(BB, BECount, ExitBlocks);