summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/PPCGCodeGeneration.cpp
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2017-10-01 12:39:14 +0000
committerTobias Grosser <tobias@grosser.es>2017-10-01 12:39:14 +0000
commit2fb847fbf65f3895af7e592e54c43266ff29156c (patch)
treec8083dcb2c1f00bbc5de2df72c77496de880faba /polly/lib/CodeGen/PPCGCodeGeneration.cpp
parent8c69954a61cd6148b1b257db346e1554670ce696 (diff)
downloadbcm5719-llvm-2fb847fbf65f3895af7e592e54c43266ff29156c.tar.gz
bcm5719-llvm-2fb847fbf65f3895af7e592e54c43266ff29156c.zip
[GPGPU] Set Polly's RTC to false in case invariant load hoisting fails
This matches the behavior we already have in lib/Codegen/CodeGeneration.cpp and makes sure that we fall back to the original code. It seems when invariant load hoisting was introduced to the GPGPU backend we missed to reset the RTC flag, such that kernels where invariant load hoisting failed executed the 'optimized' SCoP, which however is set to a simple 'unreachable'. Unsurprisingly, this results in hard to debug issues that are a lot of fun to debug. llvm-svn: 314624
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
-rw-r--r--polly/lib/CodeGen/PPCGCodeGeneration.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index a6e7867127e..9ebd25d1d89 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -3478,6 +3478,12 @@ public:
// preload invariant loads. Note: This should happen before the RTC
// because the RTC may depend on values that are invariant load hoisted.
if (!NodeBuilder.preloadInvariantLoads()) {
+ // Patch the introduced branch condition to ensure that we always execute
+ // the original SCoP.
+ auto *FalseI1 = Builder.getFalse();
+ auto *SplitBBTerm = Builder.GetInsertBlock()->getTerminator();
+ SplitBBTerm->setOperand(0, FalseI1);
+
DEBUG(dbgs() << "preloading invariant loads failed in function: " +
S->getFunction().getName() +
" | Scop Region: " + S->getNameStr());
OpenPOWER on IntegriCloud