[Polly][NewPM] Pull references to the legacy PM interface from utilities and helpers
Summary:
A couple of the utilities used to analyze or build IR make explicit use of the legacy PM on their interface, to access analysis results. This patch removes the legacy PM from the interface, and just passes the required results directly.
This shouldn't introduce any function changes, although the API technically allowed to obtain two different analysis results before, one passed by reference and one through the PM. I don't believe that was ever intended, however.
Reviewers: grosser, Meinersbur
Reviewed By: grosser
Subscribers: nemanjai, pollydev, llvm-commits
Tags: #polly
Differential Revision: https://reviews.llvm.org/D31653
llvm-svn: 299423
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index 3299b66..835f1d2 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -145,10 +145,10 @@
// which may introduce scalar dependences that prevent us from correctly
// code generating this scop.
BasicBlock *StartBlock =
- executeScopConditionally(S, this, Builder.getTrue());
+ executeScopConditionally(S, Builder.getTrue(), *DT, *RI, *LI);
auto *SplitBlock = StartBlock->getSinglePredecessor();
- IslNodeBuilder NodeBuilder(Builder, Annotator, this, *DL, *LI, *SE, *DT, S,
+ IslNodeBuilder NodeBuilder(Builder, Annotator, *DL, *LI, *SE, *DT, S,
StartBlock);
if (PerfMonitoring) {
diff --git a/polly/lib/CodeGen/IslNodeBuilder.cpp b/polly/lib/CodeGen/IslNodeBuilder.cpp
index 1d2f546..739d1f7 100644
--- a/polly/lib/CodeGen/IslNodeBuilder.cpp
+++ b/polly/lib/CodeGen/IslNodeBuilder.cpp
@@ -498,7 +498,7 @@
// omit the GuardBB in front of the loop.
bool UseGuardBB =
!SE.isKnownPredicate(Predicate, SE.getSCEV(ValueLB), SE.getSCEV(ValueUB));
- IV = createLoop(ValueLB, ValueUB, ValueInc, Builder, P, LI, DT, ExitBlock,
+ IV = createLoop(ValueLB, ValueUB, ValueInc, Builder, LI, DT, ExitBlock,
Predicate, &Annotator, Parallel, UseGuardBB);
IDToValue[IteratorID] = IV;
@@ -625,7 +625,7 @@
}
ValueMapT NewValues;
- ParallelLoopGenerator ParallelLoopGen(Builder, P, LI, DT, DL);
+ ParallelLoopGenerator ParallelLoopGen(Builder, LI, DT, DL);
IV = ParallelLoopGen.createParallelLoop(ValueLB, ValueUB, ValueInc,
SubtreeValues, NewValues, &LoopBody);
diff --git a/polly/lib/CodeGen/LoopGenerators.cpp b/polly/lib/CodeGen/LoopGenerators.cpp
index fe7e953..a1c1b71 100644
--- a/polly/lib/CodeGen/LoopGenerators.cpp
+++ b/polly/lib/CodeGen/LoopGenerators.cpp
@@ -50,7 +50,7 @@
// 'polly.indvar_next' as well as the condition to check if we execute another
// iteration of the loop. After the loop has finished, we branch to ExitBB.
Value *polly::createLoop(Value *LB, Value *UB, Value *Stride,
- PollyIRBuilder &Builder, Pass *P, LoopInfo &LI,
+ PollyIRBuilder &Builder, LoopInfo &LI,
DominatorTree &DT, BasicBlock *&ExitBB,
ICmpInst::Predicate Predicate,
ScopAnnotator *Annotator, bool Parallel,
@@ -360,7 +360,7 @@
Builder.CreateBr(CheckNextBB);
Builder.SetInsertPoint(&*--Builder.GetInsertPoint());
- IV = createLoop(LB, UB, Stride, Builder, P, LI, DT, AfterBB,
+ IV = createLoop(LB, UB, Stride, Builder, LI, DT, AfterBB,
ICmpInst::ICMP_SLE, nullptr, true, /* UseGuard */ false);
BasicBlock::iterator LoopBody = Builder.GetInsertPoint();
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index 6d28a8d..2bd1b42 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -143,11 +143,11 @@
/// @see GPUNodeBuilder::createUser
class GPUNodeBuilder : public IslNodeBuilder {
public:
- GPUNodeBuilder(PollyIRBuilder &Builder, ScopAnnotator &Annotator, Pass *P,
+ GPUNodeBuilder(PollyIRBuilder &Builder, ScopAnnotator &Annotator,
const DataLayout &DL, LoopInfo &LI, ScalarEvolution &SE,
DominatorTree &DT, Scop &S, BasicBlock *StartBlock,
gpu_prog *Prog)
- : IslNodeBuilder(Builder, Annotator, P, DL, LI, SE, DT, S, StartBlock),
+ : IslNodeBuilder(Builder, Annotator, DL, LI, SE, DT, S, StartBlock),
Prog(Prog) {
getExprBuilder().setIDToSAI(&IDToSAI);
}
@@ -1543,7 +1543,6 @@
BasicBlock *PrevBlock = Builder.GetInsertBlock();
auto EntryBlock = BasicBlock::Create(Builder.getContext(), "entry", FN);
- DominatorTree &DT = P->getAnalysis<DominatorTreeWrapperPass>().getDomTree();
DT.addNewBlock(EntryBlock, PrevBlock);
Builder.SetInsertPoint(EntryBlock);
@@ -2403,9 +2402,9 @@
// which may introduce scalar dependences that prevent us from correctly
// code generating this scop.
BasicBlock *StartBlock =
- executeScopConditionally(*S, this, Builder.getTrue());
+ executeScopConditionally(*S, Builder.getTrue(), *DT, *RI, *LI);
- GPUNodeBuilder NodeBuilder(Builder, Annotator, this, *DL, *LI, *SE, *DT, *S,
+ GPUNodeBuilder NodeBuilder(Builder, Annotator, *DL, *LI, *SE, *DT, *S,
StartBlock, Prog);
// TODO: Handle LICM
diff --git a/polly/lib/CodeGen/Utils.cpp b/polly/lib/CodeGen/Utils.cpp
index 9aa22da..31ec4fc 100644
--- a/polly/lib/CodeGen/Utils.cpp
+++ b/polly/lib/CodeGen/Utils.cpp
@@ -76,12 +76,11 @@
return MiddleBlock;
}
-BasicBlock *polly::executeScopConditionally(Scop &S, Pass *P, Value *RTC) {
+BasicBlock *polly::executeScopConditionally(Scop &S, Value *RTC,
+ DominatorTree &DT, RegionInfo &RI,
+ LoopInfo &LI) {
Region &R = S.getRegion();
PollyIRBuilder Builder(S.getEntry());
- DominatorTree &DT = P->getAnalysis<DominatorTreeWrapperPass>().getDomTree();
- RegionInfo &RI = P->getAnalysis<RegionInfoPass>().getRegionInfo();
- LoopInfo &LI = P->getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
// Before:
//