[polly] r246389 - createScalarInitialization: Always store PHI-node value

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 30 10:32:39 PDT 2015


Author: grosser
Date: Sun Aug 30 12:32:39 2015
New Revision: 246389

URL: http://llvm.org/viewvc/llvm-project?rev=246389&view=rev
Log:
createScalarInitialization: Always store PHI-node value

The current code really tries hard to use getNewScalarValue(), which checks if
not the original value, but a possible copy or demoted value needs to be stored.
In this calling context it seems, that we _always_ use the ScalarValue that
comes from the incoming PHI node, but never any other value. As also no test
cases fail, it seems right to just drop this call to getNewScalarValue and
remove the parameters that are not needed any more.

Johannes suggested that code like this might be needed for parallel code
generation with offloading, but it was still unclear if/what exactly would
be needed. As the parallel code generation does currently not support scalars
at all, we will remove this code for now and add relevant code back when
complitng the support of scalars in the parallel code generation.

Reviewers: jdoerfert

Subscribers: pollydev, llvm-commits

Differential Revision: http://reviews.llvm.org/D12470

Modified:
    polly/trunk/include/polly/CodeGen/BlockGenerators.h
    polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
    polly/trunk/lib/CodeGen/BlockGenerators.cpp

Modified: polly/trunk/include/polly/CodeGen/BlockGenerators.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/BlockGenerators.h?rev=246389&r1=246388&r2=246389&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/BlockGenerators.h (original)
+++ polly/trunk/include/polly/CodeGen/BlockGenerators.h Sun Aug 30 12:32:39 2015
@@ -147,9 +147,9 @@ public:
   /// This will initialize and finalize the scalar variables we demoted during
   /// the code generation.
   ///
-  /// @see createScalarInitialization(Region &, ValueMapT &)
+  /// @see createScalarInitialization(Region &)
   /// @see createScalarFinalization(Region &)
-  void finalizeSCoP(Scop &S, ValueMapT &VMap);
+  void finalizeSCoP(Scop &S);
 
   /// @brief An empty destructor
   virtual ~BlockGenerator(){};
@@ -387,7 +387,7 @@ protected:
   /// the SCoP we need to initialize the memory cell we demoted the PHI into
   /// with the value corresponding to that predecessor. As a SCoP is a
   /// __single__ entry region there is at most one such predecessor.
-  void createScalarInitialization(Region &R, ValueMapT &VMap);
+  void createScalarInitialization(Region &R);
 
   /// @brief Promote the values of demoted scalars after the SCoP.
   ///

Modified: polly/trunk/include/polly/CodeGen/IslNodeBuilder.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/IslNodeBuilder.h?rev=246389&r1=246388&r2=246389&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/IslNodeBuilder.h (original)
+++ polly/trunk/include/polly/CodeGen/IslNodeBuilder.h Sun Aug 30 12:32:39 2015
@@ -44,7 +44,7 @@ public:
   /// @brief Finalize code generation for the SCoP @p S.
   ///
   /// @see BlockGenerator::finalizeSCoP(Scop &S)
-  void finalizeSCoP(Scop &S) { BlockGen.finalizeSCoP(S, ValueMap); }
+  void finalizeSCoP(Scop &S) { BlockGen.finalizeSCoP(S); }
 
   IslExprBuilder &getExprBuilder() { return ExprBuilder; }
 

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=246389&r1=246388&r2=246389&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Sun Aug 30 12:32:39 2015
@@ -466,8 +466,7 @@ void BlockGenerator::generateScalarStore
   }
 }
 
-void BlockGenerator::createScalarInitialization(Region &R,
-                                                ValueMapT &GlobalMap) {
+void BlockGenerator::createScalarInitialization(Region &R) {
   // The split block __just before__ the region and optimized region.
   BasicBlock *SplitBB = R.getEnteringBlock();
   BranchInst *SplitBBTerm = cast<BranchInst>(SplitBB->getTerminator());
@@ -482,7 +481,6 @@ void BlockGenerator::createScalarInitial
   // value prior to entering the optimized region.
   Builder.SetInsertPoint(StartBB->getTerminator());
 
-  ScalarAllocaMapTy EmptyMap;
   for (const auto &PHIOpMapping : PHIOpMap) {
     const PHINode *PHI = cast<PHINode>(PHIOpMapping.getFirst());
 
@@ -493,8 +491,6 @@ void BlockGenerator::createScalarInitial
       continue;
 
     Value *ScalarValue = PHI->getIncomingValue(idx);
-    ScalarValue =
-        getNewScalarValue(ScalarValue, R, EmptyMap, GlobalMap, GlobalMap);
 
     // If the split block is the predecessor initialize the PHI operator alloca.
     Builder.CreateStore(ScalarValue, PHIOpMapping.getSecond());
@@ -545,8 +541,8 @@ void BlockGenerator::createScalarFinaliz
   }
 }
 
-void BlockGenerator::finalizeSCoP(Scop &S, ValueMapT &GlobalMap) {
-  createScalarInitialization(S.getRegion(), GlobalMap);
+void BlockGenerator::finalizeSCoP(Scop &S) {
+  createScalarInitialization(S.getRegion());
   createScalarFinalization(S.getRegion());
 }
 




More information about the llvm-commits mailing list