[polly] r215121 - Make used analysis passes explicit
Johannes Doerfert
doerfert at cs.uni-saarland.de
Thu Aug 7 21:28:58 PDT 2014
Submitted in r215121 and fixed in r215183.
On 08/07, Johannes Doerfert wrote:
> Attached a fix but I can't test it until I get home.
>
> If somebody could check if this compiles we could apply it earlier.
>
> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu
> [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Johannes Doerfert
> Sent: Thursday, August 07, 2014 10:15 AM
> To: llvm-commits at cs.uiuc.edu
> Subject: [polly] r215121 - Make used analysis passes explicit
>
> Author: jdoerfert
> Date: Thu Aug 7 12:14:54 2014
> New Revision: 215121
>
> URL: http://llvm.org/viewvc/llvm-project?rev=215121&view=rev
> Log:
> Make used analysis passes explicit
>
> Use the explicit analysis if possible, only for splitBlock we will
> continue
> to use the Pass * argument. This change allows us to remove the
> getAnalysis
> calls from the code generation.
>
> Modified:
> polly/trunk/include/polly/CodeGen/BlockGenerators.h
> polly/trunk/include/polly/CodeGen/LoopGenerators.h
> polly/trunk/lib/CodeGen/BlockGenerators.cpp
> polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
> polly/trunk/lib/CodeGen/LoopGenerators.cpp
>
> Modified: polly/trunk/include/polly/CodeGen/BlockGenerators.h
> URL:
> http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/BlockG
> enerators.h?rev=215121&r1=215120&r2=215121&view=diff
> ============================================================================
> ==
> --- polly/trunk/include/polly/CodeGen/BlockGenerators.h (original)
> +++ polly/trunk/include/polly/CodeGen/BlockGenerators.h Thu Aug 7
> +++ 12:14:54 2014
> @@ -67,22 +67,23 @@ class BlockGenerator {
> public:
> /// @brief Generate a new BasicBlock for a ScopStmt.
> ///
> - /// @param Builder The LLVM-IR Builder used to generate the
> statement. The
> - /// code is generated at the location, the Builder
> points
> - /// to.
> - /// @param Stmt The statement to code generate.
> - /// @param GlobalMap A map that defines for certain Values referenced
> from
> - /// the original code new Values they should be
> replaced
> - /// with.
> - /// @param P A reference to the pass this function is called
> from.
> - /// The pass is needed to update other analysis.
> + /// @param Builder The LLVM-IR Builder used to generate the statement.
> The
> + /// code is generated at the location, the Builder
> points to.
> + /// @param Stmt The statement to code generate.
> + /// @param GlobalMap A map that defines for certain Values referenced
> from the
> + /// original code new Values they should be replaced
> with.
> + /// @param P A reference to the pass this function is called
> from.
> + /// The pass is needed to update other analysis.
> + /// @param LI The loop info for the current function
> + /// @param SE The scalar evolution info for the current function
> /// @param Build The AST build with the new schedule.
> /// @param ExprBuilder An expression builder to generate new access
> functions.
> static void generate(PollyIRBuilder &Builder, ScopStmt &Stmt,
> ValueMapT &GlobalMap, LoopToScevMapT <S, Pass *P,
> + LoopInfo &LI, ScalarEvolution &SE,
> __isl_keep isl_ast_build *Build = nullptr,
> IslExprBuilder *ExprBuilder = nullptr) {
> - BlockGenerator Generator(Builder, Stmt, P, Build, ExprBuilder);
> + BlockGenerator Generator(Builder, Stmt, P, LI, SE, Build,
> + ExprBuilder);
> Generator.copyBB(GlobalMap, LTS);
> }
>
> @@ -90,12 +91,14 @@ protected:
> PollyIRBuilder &Builder;
> ScopStmt &Statement;
> Pass *P;
> + LoopInfo &LI;
> ScalarEvolution &SE;
> isl_ast_build *Build;
> IslExprBuilder *ExprBuilder;
>
> - BlockGenerator(PollyIRBuilder &B, ScopStmt &Stmt, Pass *P,
> - __isl_keep isl_ast_build *Build, IslExprBuilder
> *ExprBuilder);
> + BlockGenerator(PollyIRBuilder &B, ScopStmt &Stmt, Pass *P, LoopInfo &LI,
> + ScalarEvolution &SE, __isl_keep isl_ast_build *Build,
> + IslExprBuilder *ExprBuilder);
>
> /// @brief Get the new version of a Value.
> ///
> @@ -204,11 +207,15 @@ public:
> /// loop containing the statemenet.
> /// @param P A reference to the pass this function is called
> from.
> /// The pass is needed to update other analysis.
> + /// @param LI The loop info for the current function
> + /// @param SE The scalar evolution info for the current function
> static void generate(PollyIRBuilder &B, ScopStmt &Stmt,
> VectorValueMapT &GlobalMaps,
> std::vector<LoopToScevMapT> &VLTS,
> - __isl_keep isl_map *Schedule, Pass *P) {
> - VectorBlockGenerator Generator(B, GlobalMaps, VLTS, Stmt, Schedule, P);
> + __isl_keep isl_map *Schedule, Pass *P, LoopInfo &LI,
> + ScalarEvolution &SE) {
> + VectorBlockGenerator Generator(B, GlobalMaps, VLTS, Stmt, Schedule, P,
> LI,
> + SE);
> Generator.copyBB();
> }
>
> @@ -244,7 +251,8 @@ private:
>
> VectorBlockGenerator(PollyIRBuilder &B, VectorValueMapT &GlobalMaps,
> std::vector<LoopToScevMapT> &VLTS, ScopStmt &Stmt,
> - __isl_keep isl_map *Schedule, Pass *P);
> + __isl_keep isl_map *Schedule, Pass *P, LoopInfo &LI,
> + ScalarEvolution &SE);
>
> int getVectorWidth();
>
>
> Modified: polly/trunk/include/polly/CodeGen/LoopGenerators.h
> URL:
> http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/LoopGe
> nerators.h?rev=215121&r1=215120&r2=215121&view=diff
> ============================================================================
> ==
> --- polly/trunk/include/polly/CodeGen/LoopGenerators.h (original)
> +++ polly/trunk/include/polly/CodeGen/LoopGenerators.h Thu Aug 7
> +++ 12:14:54 2014
> @@ -36,6 +36,8 @@ using namespace llvm;
> /// @param Builder The builder used to create the loop.
> /// @param P A pointer to the pass that uses this function. It is
> used
> /// to update analysis information.
> +/// @param LI The loop info for the current function
> +/// @param DT The dominator tree we need to update
> /// @param ExitBlock The block the loop will exit to.
> /// @param Predicate The predicate used to generate the upper loop bound.
> /// @param Annotator This function can (optionally) take a LoopAnnotator
> which @@ -43,7 +45,8 @@ using namespace llvm;
> /// @param Parallel If this loop should be marked parallel in the
> Annotator.
> /// @return Value* The newly created induction variable for this loop.
> Value *createLoop(Value *LowerBound, Value *UpperBound, Value *Stride,
> - PollyIRBuilder &Builder, Pass *P, BasicBlock *&ExitBlock,
> + PollyIRBuilder &Builder, Pass *P, LoopInfo &LI,
> + DominatorTree &DT, BasicBlock *&ExitBlock,
> ICmpInst::Predicate Predicate,
> LoopAnnotator *Annotator = NULL, bool Parallel = false);
>
>
> Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.
> cpp?rev=215121&r1=215120&r2=215121&view=diff
> ============================================================================
> ==
> --- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
> +++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Thu Aug 7 12:14:54 2014
> @@ -67,10 +67,11 @@ bool polly::canSynthesize(const Instruct }
>
> BlockGenerator::BlockGenerator(PollyIRBuilder &B, ScopStmt &Stmt, Pass *P,
> + LoopInfo &LI, ScalarEvolution &SE,
> isl_ast_build *Build,
> IslExprBuilder *ExprBuilder)
> - : Builder(B), Statement(Stmt), P(P),
> SE(P->getAnalysis<ScalarEvolution>()),
> - Build(Build), ExprBuilder(ExprBuilder) {}
> + : Builder(B), Statement(Stmt), P(P), LI(LI), SE(SE), Build(Build),
> + ExprBuilder(ExprBuilder) {}
>
> Value *BlockGenerator::lookupAvailableValue(const Value *Old, ValueMapT
> &BBMap,
> ValueMapT &GlobalMap) const {
> @@ -209,7 +210,7 @@ Value *BlockGenerator::generateLocationA
> }
>
> Loop *BlockGenerator::getLoopForInst(const llvm::Instruction *Inst) {
> - return P->getAnalysis<LoopInfo>().getLoopFor(Inst->getParent());
> + return LI.getLoopFor(Inst->getParent());
> }
>
> Value *BlockGenerator::generateScalarLoad(const LoadInst *Load, @@ -282,14
> +283,12 @@ void BlockGenerator::copyBB(ValueMapT &G
> copyInstruction(&Inst, BBMap, GlobalMap, LTS); }
>
> -VectorBlockGenerator::VectorBlockGenerator(PollyIRBuilder &B,
> - VectorValueMapT &GlobalMaps,
> - std::vector<LoopToScevMapT>
> &VLTS,
> - ScopStmt &Stmt,
> - __isl_keep isl_map *Schedule,
> - Pass *P)
> - : BlockGenerator(B, Stmt, P, nullptr, nullptr), GlobalMaps(GlobalMaps),
> - VLTS(VLTS), Schedule(Schedule) {
> +VectorBlockGenerator::VectorBlockGenerator(
> + PollyIRBuilder &B, VectorValueMapT &GlobalMaps,
> + std::vector<LoopToScevMapT> &VLTS, ScopStmt &Stmt,
> + __isl_keep isl_map *Schedule, Pass *P, LoopInfo &LI, ScalarEvolution
> &SE)
> + : BlockGenerator(B, Stmt, P, LI, SE, nullptr, nullptr),
> + GlobalMaps(GlobalMaps), VLTS(VLTS), Schedule(Schedule) {
> assert(GlobalMaps.size() > 1 && "Only one vector lane found");
> assert(Schedule && "No statement domain provided"); }
>
> Modified: polly/trunk/lib/CodeGen/IslCodeGeneration.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslCodeGeneratio
> n.cpp?rev=215121&r1=215120&r2=215121&view=diff
> ============================================================================
> ==
> --- polly/trunk/lib/CodeGen/IslCodeGeneration.cpp (original)
> +++ polly/trunk/lib/CodeGen/IslCodeGeneration.cpp Thu Aug 7 12:14:54
> +++ 2014
> @@ -58,9 +58,10 @@ using namespace llvm;
>
> class IslNodeBuilder {
> public:
> - IslNodeBuilder(PollyIRBuilder &Builder, LoopAnnotator &Annotator, Pass
> *P)
> + IslNodeBuilder(PollyIRBuilder &Builder, LoopAnnotator &Annotator, Pass
> *P,
> + LoopInfo &LI, ScalarEvolution &SE, DominatorTree &DT)
> : Builder(Builder), Annotator(Annotator), ExprBuilder(Builder,
> IDToValue),
> - P(P) {}
> + P(P), LI(LI), SE(SE), DT(DT) {}
>
> /// @brief Add the mappings from array id's to array llvm::Value's.
> void addMemoryAccesses(Scop &S);
> @@ -73,6 +74,9 @@ private:
> LoopAnnotator &Annotator;
> IslExprBuilder ExprBuilder;
> Pass *P;
> + LoopInfo &LI;
> + ScalarEvolution &SE;
> + DominatorTree &DT;
>
> // This maps an isl_id* to the Value* it has in the generated program.
> For now
> // on, the only isl_ids that are stored here are the newly calculated
> loop @@ -239,7 +243,7 @@ void IslNodeBuilder::createUserVector(__
> isl_map *S = isl_map_from_union_map(Schedule);
>
> createSubstitutionsVector(Expr, Stmt, VectorMap, VLTS, IVS, IteratorID);
> - VectorBlockGenerator::generate(Builder, *Stmt, VectorMap, VLTS, S, P);
> + VectorBlockGenerator::generate(Builder, *Stmt, VectorMap, VLTS, S, P,
> + LI, SE);
>
> isl_map_free(S);
> isl_id_free(Id);
> @@ -350,8 +354,8 @@ void IslNodeBuilder::createForSequential
> if (MaxType != ValueInc->getType())
> ValueInc = Builder.CreateSExt(ValueInc, MaxType);
>
> - IV = createLoop(ValueLB, ValueUB, ValueInc, Builder, P, ExitBlock,
> Predicate,
> - &Annotator, Parallel);
> + IV = createLoop(ValueLB, ValueUB, ValueInc, Builder, P, LI, DT,
> ExitBlock,
> + Predicate, &Annotator, Parallel);
> IDToValue[IteratorID] = IV;
>
> create(Body);
> @@ -395,12 +399,10 @@ void IslNodeBuilder::createIf(__isl_take
> BasicBlock *ThenBB = BasicBlock::Create(Context, "polly.then", F);
> BasicBlock *ElseBB = BasicBlock::Create(Context, "polly.else", F);
>
> - DominatorTree &DT =
> P->getAnalysis<DominatorTreeWrapperPass>().getDomTree();
> DT.addNewBlock(ThenBB, CondBB);
> DT.addNewBlock(ElseBB, CondBB);
> DT.changeImmediateDominator(MergeBB, CondBB);
>
> - LoopInfo &LI = P->getAnalysis<LoopInfo>();
> Loop *L = LI.getLoopFor(CondBB);
> if (L) {
> L->addBasicBlockToLoop(ThenBB, LI.getBase()); @@ -490,7 +492,7 @@ void
> IslNodeBuilder::createUser(__isl_ta
> Stmt = (ScopStmt *)isl_id_get_user(Id);
>
> createSubstitutions(Expr, Stmt, VMap, LTS);
> - BlockGenerator::generate(Builder, *Stmt, VMap, LTS, P,
> + BlockGenerator::generate(Builder, *Stmt, VMap, LTS, P, LI, SE,
> IslAstInfo::getBuild(User), &ExprBuilder);
>
> isl_ast_node_free(User);
> @@ -529,7 +531,7 @@ void IslNodeBuilder::create(__isl_take i }
>
> void IslNodeBuilder::addParameters(__isl_take isl_set *Context) {
> - SCEVExpander Rewriter(P->getAnalysis<ScalarEvolution>(), "polly");
> + SCEVExpander Rewriter(SE, "polly");
>
> for (unsigned i = 0; i < isl_set_dim(Context, isl_dim_param); ++i) {
> isl_id *Id;
> @@ -567,7 +569,10 @@ public:
> IslCodeGeneration() : ScopPass(ID) {}
>
> bool runOnScop(Scop &S) {
> + LoopInfo &LI = getAnalysis<LoopInfo>();
> IslAstInfo &AstInfo = getAnalysis<IslAstInfo>();
> + ScalarEvolution &SE = getAnalysis<ScalarEvolution>();
> + DominatorTree &DT =
> + getAnalysis<DominatorTreeWrapperPass>().getDomTree();
>
> assert(!S.getRegion().isTopLevelRegion() &&
> "Top level regions are not supported"); @@ -581,7 +586,7 @@
> public:
> polly::IRInserter(Annotator));
> Builder.SetInsertPoint(StartBlock->begin());
>
> - IslNodeBuilder NodeBuilder(Builder, Annotator, this);
> + IslNodeBuilder NodeBuilder(Builder, Annotator, this, LI, SE, DT);
>
> Builder.SetInsertPoint(StartBlock->getSinglePredecessor()->begin());
> NodeBuilder.addMemoryAccesses(S);
>
> Modified: polly/trunk/lib/CodeGen/LoopGenerators.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/LoopGenerators.c
> pp?rev=215121&r1=215120&r2=215121&view=diff
> ============================================================================
> ==
> --- polly/trunk/lib/CodeGen/LoopGenerators.cpp (original)
> +++ polly/trunk/lib/CodeGen/LoopGenerators.cpp Thu Aug 7 12:14:54 2014
> @@ -47,11 +47,10 @@ using namespace polly; // TODO: We currently always
> create the GuardBB. If we can prove the loop is
> // always executed at least once, we can get rid of this branch.
> Value *polly::createLoop(Value *LB, Value *UB, Value *Stride,
> - PollyIRBuilder &Builder, Pass *P, BasicBlock
> *&ExitBB,
> + PollyIRBuilder &Builder, Pass *P, LoopInfo &LI,
> + DominatorTree &DT, BasicBlock *&ExitBB,
> ICmpInst::Predicate Predicate,
> LoopAnnotator *Annotator, bool Parallel) {
> - DominatorTree &DT =
> P->getAnalysis<DominatorTreeWrapperPass>().getDomTree();
> - LoopInfo &LI = P->getAnalysis<LoopInfo>();
> Function *F = Builder.GetInsertBlock()->getParent();
> LLVMContext &Context = F->getContext();
>
> @@ -321,7 +320,8 @@ Value *OMPGenerator::createSubfunction(V
>
> Builder.CreateBr(CheckNextBB);
> Builder.SetInsertPoint(--Builder.GetInsertPoint());
> - IV = createLoop(LowerBound, UpperBound, Stride, Builder, P, AfterBB,
> + LoopInfo &LI = P->getAnalysis<LoopInfo>(); IV =
> + createLoop(LowerBound, UpperBound, Stride, Builder, P, LI, DT,
> + AfterBB,
> ICmpInst::ICMP_SLE);
>
> BasicBlock::iterator LoopBody = Builder.GetInsertPoint();
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> From: llvm.buildmaster at lab.llvm.org
> To: Johannes Doerfert <jdoerfert at codeaurora.org>
> Cc: gkistanova at gmail.com
> Date: Thu, 7 Aug 2014 10:31:39 -0700
> Subject: buildbot failure in LLVM on polly-amd64-linux
>
> The Buildbot has detected a new failure on builder polly-amd64-linux while building polly.
> Full details are available at:
> http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/21819
>
> Buildbot URL: http://lab.llvm.org:8011/
>
> Buildslave for this Build: grosser1
>
> Build Reason: scheduler
> Build Source Stamp: [branch trunk] 215121
> Blamelist: jdoerfert
>
> BUILD FAILED: failed build_polly
>
> sincerely,
> -The Buildbot
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
--
Johannes Doerfert
Researcher / PhD Student
Compiler Design Lab (Prof. Hack)
Saarland University, Computer Science
Building E1.3, Room 4.26
Tel. +49 (0)681 302-57521 : doerfert at cs.uni-saarland.de
Fax. +49 (0)681 302-3065 : http://www.cdl.uni-saarland.de/people/doerfert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 213 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140807/a3636628/attachment.sig>
More information about the llvm-commits
mailing list