[polly] r306283 - [NFC] Return both polly.start and polly.exiting from executeScopConditionally.

Andreas Simbuerger via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 05:17:11 PDT 2017


Author: simbuerg
Date: Mon Jun 26 05:17:11 2017
New Revision: 306283

URL: http://llvm.org/viewvc/llvm-project?rev=306283&view=rev
Log:
[NFC] Return both polly.start and polly.exiting from executeScopConditionally.

This commit returns both the start and the exit block that are created
by executeScopConditionally.

In a future commit we will make use of the exit block. Before we would
have to use the implicit property that there won't be any code generated
between polly.start and polly.exiting at the time of use to find the
correct block ('polly.exiting').

All usage location are semantically unchanged.

Modified:
    polly/trunk/include/polly/CodeGen/Utils.h
    polly/trunk/lib/CodeGen/CodeGeneration.cpp
    polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
    polly/trunk/lib/CodeGen/Utils.cpp

Modified: polly/trunk/include/polly/CodeGen/Utils.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/CodeGen/Utils.h?rev=306283&r1=306282&r2=306283&view=diff
==============================================================================
--- polly/trunk/include/polly/CodeGen/Utils.h (original)
+++ polly/trunk/include/polly/CodeGen/Utils.h Mon Jun 26 05:17:11 2017
@@ -13,6 +13,8 @@
 #ifndef POLLY_CODEGEN_UTILS_H
 #define POLLY_CODEGEN_UTILS_H
 
+#include <utility>
+
 namespace llvm {
 class Pass;
 class Value;
@@ -26,6 +28,7 @@ namespace polly {
 
 class Scop;
 
+using BBPair = std::pair<llvm::BasicBlock *, llvm::BasicBlock *>;
 /// Execute a Scop conditionally wrt @p RTC.
 ///
 /// In the CFG the optimized code of the Scop is generated next to the
@@ -58,9 +61,8 @@ 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::Value *RTC,
-                                           llvm::DominatorTree &DT,
-                                           llvm::RegionInfo &RI,
-                                           llvm::LoopInfo &LI);
+BBPair 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=306283&r1=306282&r2=306283&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Mon Jun 26 05:17:11 2017
@@ -175,8 +175,10 @@ static bool CodeGen(Scop &S, IslAstInfo
   // the SCEVExpander may introduce while code generating the parameters and
   // which may introduce scalar dependences that prevent us from correctly
   // code generating this scop.
-  BasicBlock *StartBlock =
+  BBPair StartExitBlocks =
       executeScopConditionally(S, Builder.getTrue(), DT, RI, LI);
+  BasicBlock *StartBlock = std::get<0>(StartExitBlocks);
+
   removeLifetimeMarkers(R);
   auto *SplitBlock = StartBlock->getSinglePredecessor();
 

Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=306283&r1=306282&r2=306283&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Mon Jun 26 05:17:11 2017
@@ -2663,8 +2663,9 @@ public:
     // the SCEVExpander may introduce while code generating the parameters and
     // which may introduce scalar dependences that prevent us from correctly
     // code generating this scop.
-    BasicBlock *StartBlock =
+    BBPair StartExitBlocks =
         executeScopConditionally(*S, Builder.getTrue(), *DT, *RI, *LI);
+    BasicBlock *StartBlock = std::get<0>(StartExitBlocks);
 
     GPUNodeBuilder NodeBuilder(Builder, Annotator, *DL, *LI, *SE, *DT, *S,
                                StartBlock, Prog, Runtime, Architecture);

Modified: polly/trunk/lib/CodeGen/Utils.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/Utils.cpp?rev=306283&r1=306282&r2=306283&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/Utils.cpp (original)
+++ polly/trunk/lib/CodeGen/Utils.cpp Mon Jun 26 05:17:11 2017
@@ -76,9 +76,9 @@ static BasicBlock *splitEdge(BasicBlock
   return MiddleBlock;
 }
 
-BasicBlock *polly::executeScopConditionally(Scop &S, Value *RTC,
-                                            DominatorTree &DT, RegionInfo &RI,
-                                            LoopInfo &LI) {
+polly::BBPair polly::executeScopConditionally(Scop &S, Value *RTC,
+                                              DominatorTree &DT, RegionInfo &RI,
+                                              LoopInfo &LI) {
   Region &R = S.getRegion();
   PollyIRBuilder Builder(S.getEntry());
 
@@ -216,5 +216,5 @@ BasicBlock *polly::executeScopConditiona
   //      ExitBB                   //
   //      /    \                   //
 
-  return StartBlock;
+  return std::make_pair(StartBlock, ExitingBlock);
 }




More information about the llvm-commits mailing list