diff options
author | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2015-11-07 19:46:04 +0000 |
---|---|---|
committer | Johannes Doerfert <doerfert@cs.uni-saarland.de> | 2015-11-07 19:46:04 +0000 |
commit | c4898504ea6089a3a45bd389e8fa5db6f244da90 (patch) | |
tree | 6ee5de127c9b95b36e4258f23f61870b42834a0d /polly/lib/CodeGen/CodeGeneration.cpp | |
parent | 44483c559935ecfccfae5b6fbe1386bad8693a2a (diff) | |
download | bcm5719-llvm-c4898504ea6089a3a45bd389e8fa5db6f244da90.tar.gz bcm5719-llvm-c4898504ea6089a3a45bd389e8fa5db6f244da90.zip |
[FIX] Bail out if there is a dependence cycle between invariant loads
While the program cannot cause a dependence cycle between invariant
loads, additional constraints (e.g., to ensure finite loops) can
introduce them. It is hard to detect them in the SCoP description,
thus we will only check for them at code generation time. If such a
recursion is detected we will bail out the code generation and place a
"false" runtime check to guarantee the original code is used.
This fixes bug 25443.
llvm-svn: 252412
Diffstat (limited to 'polly/lib/CodeGen/CodeGeneration.cpp')
-rw-r--r-- | polly/lib/CodeGen/CodeGeneration.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp index 7e6f044953d..95ddbfbbfd6 100644 --- a/polly/lib/CodeGen/CodeGeneration.cpp +++ b/polly/lib/CodeGen/CodeGeneration.cpp @@ -147,8 +147,15 @@ public: // parameters they reference. Afterwards, for the remaining parameters that // might reference the hoisted loads. Finally, build the runtime check // that might reference both hoisted loads as well as parameters. + // If the hoisting fails we have to bail and execute the original code. Builder.SetInsertPoint(SplitBlock->getTerminator()); - NodeBuilder.preloadInvariantLoads(); + if (!NodeBuilder.preloadInvariantLoads()) { + auto *FalseI1 = Builder.getFalse(); + Builder.GetInsertBlock()->getTerminator()->setOperand(0, FalseI1); + isl_ast_node_free(AstRoot); + return true; + } + NodeBuilder.addParameters(S.getContext()); Value *RTC = buildRTC(Builder, NodeBuilder.getExprBuilder()); |