diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2015-01-18 09:21:15 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2015-01-18 09:21:15 +0000 |
commit | b5797b659f879474b4081c4e1a00e955c38a4dcb (patch) | |
tree | 4c93b94e979e68942369e697d83c8bc0574bd966 /llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | |
parent | a0a1a8726f92e4032a8ecafe807f6976d4282cb5 (diff) | |
download | bcm5719-llvm-b5797b659f879474b4081c4e1a00e955c38a4dcb.tar.gz bcm5719-llvm-b5797b659f879474b4081c4e1a00e955c38a4dcb.zip |
[PM] Pull the analyses used for another utility routine into its API
rather than relying on the pass object.
This one is a bit annoying, but will pay off. First, supporting this one
will make the next one much easier, and for utilities like LoopSimplify,
this is moving them (slowly) closer to not having to pass the pass
object around throughout their APIs.
llvm-svn: 226396
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp index dff756ed127..82b4f0922a2 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp @@ -23,6 +23,7 @@ #include "llvm/Transforms/Utils/UnrollLoop.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/LoopIterator.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/ScalarEvolution.h" @@ -32,6 +33,7 @@ #include "llvm/IR/Metadata.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Cloning.h" #include <algorithm> @@ -59,7 +61,8 @@ STATISTIC(NumRuntimeUnrolled, static void ConnectProlog(Loop *L, Value *TripCount, unsigned Count, BasicBlock *LastPrologBB, BasicBlock *PrologEnd, BasicBlock *OrigPH, BasicBlock *NewPH, - ValueToValueMapTy &VMap, Pass *P) { + ValueToValueMapTy &VMap, AliasAnalysis *AA, + DominatorTree *DT, LoopInfo *LI, Pass *P) { BasicBlock *Latch = L->getLoopLatch(); assert(Latch && "Loop must have a latch"); @@ -117,7 +120,8 @@ static void ConnectProlog(Loop *L, Value *TripCount, unsigned Count, // Split the exit to maintain loop canonicalization guarantees SmallVector<BasicBlock*, 4> Preds(pred_begin(Exit), pred_end(Exit)); if (!Exit->isLandingPad()) { - SplitBlockPredecessors(Exit, Preds, ".unr-lcssa", P); + SplitBlockPredecessors(Exit, Preds, ".unr-lcssa", AA, DT, LI, + P->mustPreserveAnalysisID(LCSSAID)); } else { SmallVector<BasicBlock*, 2> NewBBs; SplitLandingPadPredecessors(Exit, Preds, ".unr1-lcssa", ".unr2-lcssa", @@ -317,7 +321,8 @@ bool llvm::UnrollRuntimeLoopProlog(Loop *L, unsigned Count, LoopInfo *LI, if (Loop *ParentLoop = L->getParentLoop()) SE->forgetLoop(ParentLoop); - // Grab the dominator tree so we can preserve it. + // Grab analyses that we preserve. + auto *AA = LPM->getAnalysisIfAvailable<AliasAnalysis>(); auto *DTWP = LPM->getAnalysisIfAvailable<DominatorTreeWrapperPass>(); auto *DT = DTWP ? &DTWP->getDomTree() : nullptr; @@ -397,7 +402,7 @@ bool llvm::UnrollRuntimeLoopProlog(Loop *L, unsigned Count, LoopInfo *LI, // PHI functions. BasicBlock *LastLoopBB = cast<BasicBlock>(VMap[Latch]); ConnectProlog(L, TripCount, Count, LastLoopBB, PEnd, PH, NewPH, VMap, - LPM->getAsPass()); + AA, DT, LI, LPM->getAsPass()); NumRuntimeUnrolled++; return true; } |