From 2fb847fbf65f3895af7e592e54c43266ff29156c Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Sun, 1 Oct 2017 12:39:14 +0000 Subject: [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 --- polly/lib/CodeGen/PPCGCodeGeneration.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp') 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()); -- cgit v1.2.3