[polly] r299423 - [Polly][NewPM] Pull references to the legacy PM interface from utilities and helpers
Philip Pfaffe via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 4 03:01:54 PDT 2017
Author: pfaffe
Date: Tue Apr 4 05:01:53 2017
New Revision: 299423
URL: http://llvm.org/viewvc/llvm-project?rev=299423&view=rev
Log:
[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
Modified:
polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
polly/trunk/include/polly/CodeGen/LoopGenerators.h
polly/trunk/include/polly/CodeGen/Utils.h
polly/trunk/lib/CodeGen/CodeGeneration.cpp
polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
polly/trunk/lib/CodeGen/LoopGenerators.cpp
polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
polly/trunk/lib/CodeGen/Utils.cpp
Modified: polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslNodeBuilder.h?rev=299423&r1=299422&r2=299423&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslNodeBuilder.h (original)
+++ polly/trunk/include/polly/CodeGen/IslNodeBuilder.h Tue Apr 4 05:01:53 2017
@@ -60,7 +60,7 @@ isl_stat addReferencesFromStmt(const Sco
class IslNodeBuilder {
public:
- IslNodeBuilder(PollyIRBuilder &Builder, ScopAnnotator &Annotator, Pass *P,
+ IslNodeBuilder(PollyIRBuilder &Builder, ScopAnnotator &Annotator,
const DataLayout &DL, LoopInfo &LI, ScalarEvolution &SE,
DominatorTree &DT, Scop &S, BasicBlock *StartBlock)
: S(S), Builder(Builder), Annotator(Annotator),
@@ -68,7 +68,7 @@ public:
StartBlock),
BlockGen(Builder, LI, SE, DT, ScalarMap, EscapeMap, ValueMap,
&ExprBuilder, StartBlock),
- RegionGen(BlockGen), P(P), DL(DL), LI(LI), SE(SE), DT(DT),
+ RegionGen(BlockGen), DL(DL), LI(LI), SE(SE), DT(DT),
StartBlock(StartBlock) {}
virtual ~IslNodeBuilder() = default;
@@ -138,7 +138,6 @@ protected:
/// The generator used to copy a non-affine region.
RegionGenerator RegionGen;
- Pass *const P;
const DataLayout &DL;
LoopInfo &LI;
ScalarEvolution &SE;
Modified: polly/trunk/include/polly/CodeGen/LoopGenerators.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/LoopGenerators.h?rev=299423&r1=299422&r2=299423&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/LoopGenerators.h (original)
+++ polly/trunk/include/polly/CodeGen/LoopGenerators.h Tue Apr 4 05:01:53 2017
@@ -50,9 +50,8 @@ using namespace llvm;
///
/// @return Value* The newly created induction variable for this loop.
Value *createLoop(Value *LowerBound, Value *UpperBound, Value *Stride,
- PollyIRBuilder &Builder, Pass *P, LoopInfo &LI,
- DominatorTree &DT, BasicBlock *&ExitBlock,
- ICmpInst::Predicate Predicate,
+ PollyIRBuilder &Builder, LoopInfo &LI, DominatorTree &DT,
+ BasicBlock *&ExitBlock, ICmpInst::Predicate Predicate,
ScopAnnotator *Annotator = NULL, bool Parallel = false,
bool UseGuard = true);
@@ -99,9 +98,9 @@ Value *createLoop(Value *LowerBound, Val
class ParallelLoopGenerator {
public:
/// Create a parallel loop generator for the current function.
- ParallelLoopGenerator(PollyIRBuilder &Builder, Pass *P, LoopInfo &LI,
+ ParallelLoopGenerator(PollyIRBuilder &Builder, LoopInfo &LI,
DominatorTree &DT, const DataLayout &DL)
- : Builder(Builder), P(P), LI(LI), DT(DT),
+ : Builder(Builder), LI(LI), DT(DT),
LongType(
Type::getIntNTy(Builder.getContext(), DL.getPointerSizeInBits())),
M(Builder.GetInsertBlock()->getParent()->getParent()) {}
@@ -131,9 +130,6 @@ private:
/// The IR builder we use to create instructions.
PollyIRBuilder &Builder;
- /// A pass pointer to update analysis information.
- Pass *P;
-
/// The loop info of the current function we need to update.
LoopInfo &LI;
Modified: polly/trunk/include/polly/CodeGen/Utils.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/Utils.h?rev=299423&r1=299422&r2=299423&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/Utils.h (original)
+++ polly/trunk/include/polly/CodeGen/Utils.h Tue Apr 4 05:01:53 2017
@@ -17,6 +17,9 @@ namespace llvm {
class Pass;
class Value;
class BasicBlock;
+class DominatorTree;
+class RegionInfo;
+class LoopInfo;
} // namespace llvm
namespace polly {
@@ -55,7 +58,9 @@ class Scop;
/// @param RTC The runtime condition checked before executing the new SCoP.
///
/// @return The 'StartBlock' to which new code can be added.
-llvm::BasicBlock *executeScopConditionally(Scop &S, llvm::Pass *P,
- llvm::Value *RTC);
+llvm::BasicBlock *executeScopConditionally(Scop &S, llvm::Value *RTC,
+ llvm::DominatorTree &DT,
+ llvm::RegionInfo &RI,
+ llvm::LoopInfo &LI);
} // namespace polly
#endif
Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=299423&r1=299422&r2=299423&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Tue Apr 4 05:01:53 2017
@@ -145,10 +145,10 @@ public:
// 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) {
Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=299423&r1=299422&r2=299423&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Tue Apr 4 05:01:53 2017
@@ -498,7 +498,7 @@ void IslNodeBuilder::createForSequential
// 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 @@ void IslNodeBuilder::createForParallel(_
}
ValueMapT NewValues;
- ParallelLoopGenerator ParallelLoopGen(Builder, P, LI, DT, DL);
+ ParallelLoopGenerator ParallelLoopGen(Builder, LI, DT, DL);
IV = ParallelLoopGen.createParallelLoop(ValueLB, ValueUB, ValueInc,
SubtreeValues, NewValues, &LoopBody);
Modified: polly/trunk/lib/CodeGen/LoopGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/LoopGenerators.cpp?rev=299423&r1=299422&r2=299423&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/LoopGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/LoopGenerators.cpp Tue Apr 4 05:01:53 2017
@@ -50,7 +50,7 @@ static cl::opt<int>
// '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 @@ Value *ParallelLoopGenerator::createSubF
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();
Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=299423&r1=299422&r2=299423&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Tue Apr 4 05:01:53 2017
@@ -143,11 +143,11 @@ static __isl_give isl_id_to_ast_expr *po
/// @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 @@ void GPUNodeBuilder::createKernelFunctio
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 @@ public:
// 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
Modified: polly/trunk/lib/CodeGen/Utils.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/Utils.cpp?rev=299423&r1=299422&r2=299423&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/Utils.cpp (original)
+++ polly/trunk/lib/CodeGen/Utils.cpp Tue Apr 4 05:01:53 2017
@@ -76,12 +76,11 @@ static BasicBlock *splitEdge(BasicBlock
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:
//
More information about the llvm-commits
mailing list