[polly] r270429 - Use the SCoP directly for canSynthesize [NFC]

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 05:47:09 PDT 2016


Author: jdoerfert
Date: Mon May 23 07:47:09 2016
New Revision: 270429

URL: http://llvm.org/viewvc/llvm-project?rev=270429&view=rev
Log:
Use the SCoP directly for canSynthesize [NFC]

Modified:
    polly/trunk/include/polly/Support/ScopHelper.h
    polly/trunk/lib/Analysis/ScopInfo.cpp
    polly/trunk/lib/CodeGen/BlockGenerators.cpp
    polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
    polly/trunk/lib/Support/ScopHelper.cpp

Modified: polly/trunk/include/polly/Support/ScopHelper.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/Support/ScopHelper.h?rev=270429&r1=270428&r2=270429&view=diff
==============================================================================
--- polly/trunk/include/polly/Support/ScopHelper.h (original)
+++ polly/trunk/include/polly/Support/ScopHelper.h Mon May 23 07:47:09 2016
@@ -395,15 +395,15 @@ bool isIgnoredIntrinsic(const llvm::Valu
 /// ensure that their operands are available during code generation.
 ///
 /// @param V The value to check.
+/// @param S The current SCoP.
 /// @param LI The LoopInfo analysis.
 /// @param SE The scalar evolution database.
-/// @param R The region out of which SSA names are parameters.
 /// @param Scope Location where the value would by synthesized.
 /// @return If the instruction I can be regenerated from its
 ///         scalar evolution representation, return true,
 ///         otherwise return false.
-bool canSynthesize(const llvm::Value *V, const llvm::LoopInfo *LI,
-                   llvm::ScalarEvolution *SE, const llvm::Region *R,
+bool canSynthesize(const llvm::Value *V, const Scop &S,
+                   const llvm::LoopInfo *LI, llvm::ScalarEvolution *SE,
                    llvm::Loop *Scope);
 
 /// @brief Return the block in which a value is used.

Modified: polly/trunk/lib/Analysis/ScopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopInfo.cpp?rev=270429&r1=270428&r2=270429&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp (original)
+++ polly/trunk/lib/Analysis/ScopInfo.cpp Mon May 23 07:47:09 2016
@@ -4255,7 +4255,7 @@ void ScopInfo::buildPHIAccesses(PHINode
   // the region. If it is not it can only be in the exit block of the region.
   // In this case we model the operands but not the PHI itself.
   auto *Scope = LI->getLoopFor(PHI->getParent());
-  if (!IsExitBlock && canSynthesize(PHI, LI, SE, &scop->getRegion(), Scope))
+  if (!IsExitBlock && canSynthesize(PHI, *scop, LI, SE, Scope))
     return;
 
   // PHI nodes are modeled as if they had been demoted prior to the SCoP
@@ -4738,9 +4738,8 @@ void ScopInfo::ensureValueRead(Value *V,
 
   // If the instruction can be synthesized and the user is in the region we do
   // not need to add a value dependences.
-  Region &ScopRegion = scop->getRegion();
   auto *Scope = LI->getLoopFor(UserBB);
-  if (canSynthesize(V, LI, SE, &ScopRegion, Scope))
+  if (canSynthesize(V, *scop, LI, SE, Scope))
     return;
 
   // Do not build scalar dependences for required invariant loads as we will

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=270429&r1=270428&r2=270429&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Mon May 23 07:47:09 2016
@@ -237,7 +237,7 @@ void BlockGenerator::generateScalarStore
 bool BlockGenerator::canSyntheziseInStmt(ScopStmt &Stmt, Instruction *Inst) {
   Loop *L = getLoopForStmt(Stmt);
   return (Stmt.isBlockStmt() || !Stmt.getRegion()->contains(L)) &&
-         canSynthesize(Inst, &LI, &SE, &Stmt.getParent()->getRegion(), L);
+         canSynthesize(Inst, *Stmt.getParent(), &LI, &SE, L);
 }
 
 void BlockGenerator::copyInstruction(ScopStmt &Stmt, Instruction *Inst,

Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=270429&r1=270428&r2=270429&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Mon May 23 07:47:09 2016
@@ -180,7 +180,7 @@ int IslNodeBuilder::getNumberOfIteration
 struct SubtreeReferences {
   LoopInfo &LI;
   ScalarEvolution &SE;
-  Region &R;
+  Scop &S;
   ValueMapT &GlobalMap;
   SetVector<Value *> &Values;
   SetVector<const SCEV *> &SCEVs;
@@ -193,7 +193,7 @@ static int findReferencesInBlock(struct
   for (const Instruction &Inst : *BB)
     for (Value *SrcVal : Inst.operands()) {
       auto *Scope = References.LI.getLoopFor(BB);
-      if (canSynthesize(SrcVal, &References.LI, &References.SE, &References.R,
+      if (canSynthesize(SrcVal, References.S, &References.LI, &References.SE,
                         Scope)) {
         References.SCEVs.insert(References.SE.getSCEVAtScope(SrcVal, Scope));
         continue;
@@ -292,7 +292,7 @@ void IslNodeBuilder::getReferencesInSubt
 
   SetVector<const SCEV *> SCEVs;
   struct SubtreeReferences References = {
-      LI, SE, S.getRegion(), ValueMap, Values, SCEVs, getBlockGenerator()};
+      LI, SE, S, ValueMap, Values, SCEVs, getBlockGenerator()};
 
   for (const auto &I : IDToValue)
     Values.insert(I.second);

Modified: polly/trunk/lib/Support/ScopHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Support/ScopHelper.cpp?rev=270429&r1=270428&r2=270429&view=diff
==============================================================================
--- polly/trunk/lib/Support/ScopHelper.cpp (original)
+++ polly/trunk/lib/Support/ScopHelper.cpp Mon May 23 07:47:09 2016
@@ -441,14 +441,15 @@ bool polly::isIgnoredIntrinsic(const Val
   return false;
 }
 
-bool polly::canSynthesize(const Value *V, const llvm::LoopInfo *LI,
-                          ScalarEvolution *SE, const Region *R, Loop *Scope) {
+bool polly::canSynthesize(const Value *V, const Scop &S,
+                          const llvm::LoopInfo *LI, ScalarEvolution *SE,
+                          Loop *Scope) {
   if (!V || !SE->isSCEVable(V->getType()))
     return false;
 
   if (const SCEV *Scev = SE->getSCEVAtScope(const_cast<Value *>(V), Scope))
     if (!isa<SCEVCouldNotCompute>(Scev))
-      if (!hasScalarDepsInsideRegion(Scev, R, Scope, false))
+      if (!hasScalarDepsInsideRegion(Scev, &S.getRegion(), Scope, false))
         return true;
 
   return false;




More information about the llvm-commits mailing list