summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--polly/include/polly/CodeGen/Utils.h10
-rw-r--r--polly/lib/CodeGen/CodeGeneration.cpp4
-rw-r--r--polly/lib/CodeGen/PPCGCodeGeneration.cpp3
-rw-r--r--polly/lib/CodeGen/Utils.cpp8
4 files changed, 15 insertions, 10 deletions
diff --git a/polly/include/polly/CodeGen/Utils.h b/polly/include/polly/CodeGen/Utils.h
index 65047aaf77c..2fa3ccf5e35 100644
--- a/polly/include/polly/CodeGen/Utils.h
+++ b/polly/include/polly/CodeGen/Utils.h
@@ -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
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp
index 5569378982f..41ee788402f 100644
--- a/polly/lib/CodeGen/CodeGeneration.cpp
+++ b/polly/lib/CodeGen/CodeGeneration.cpp
@@ -175,8 +175,10 @@ static bool CodeGen(Scop &S, IslAstInfo &AI, LoopInfo &LI, DominatorTree &DT,
// 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();
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index cff500e3bd9..02b40161503 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -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);
diff --git a/polly/lib/CodeGen/Utils.cpp b/polly/lib/CodeGen/Utils.cpp
index 31ec4fcab4b..9c2cfd03aec 100644
--- a/polly/lib/CodeGen/Utils.cpp
+++ b/polly/lib/CodeGen/Utils.cpp
@@ -76,9 +76,9 @@ static BasicBlock *splitEdge(BasicBlock *Prev, BasicBlock *Succ,
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::executeScopConditionally(Scop &S, Value *RTC,
// ExitBB //
// / \ //
- return StartBlock;
+ return std::make_pair(StartBlock, ExitingBlock);
}
OpenPOWER on IntegriCloud