diff options
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
-rw-r--r-- | polly/lib/CodeGen/PPCGCodeGeneration.cpp | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index d3a13edc3b6..3ab1b6496c3 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "polly/CodeGen/PPCGCodeGeneration.h" +#include "polly/CodeGen/CodeGeneration.h" #include "polly/CodeGen/IslAst.h" #include "polly/CodeGen/IslNodeBuilder.h" #include "polly/CodeGen/Utils.h" @@ -3373,7 +3374,6 @@ public: // TODO: Handle LICM auto SplitBlock = StartBlock->getSinglePredecessor(); Builder.SetInsertPoint(SplitBlock->getTerminator()); - NodeBuilder.addParameters(S->getContext().release()); isl_ast_build *Build = isl_ast_build_alloc(S->getIslCtx()); isl_ast_expr *Condition = IslAst::buildRunCondition(*S, Build); @@ -3383,17 +3383,34 @@ 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()) - report_fatal_error("preloading invariant loads failed in function: " + - S->getFunction().getName() + - " | Scop Region: " + S->getNameStr()); + if (!NodeBuilder.preloadInvariantLoads()) { + DEBUG(dbgs() << "preloading invariant loads failed in function: " + + S->getFunction().getName() + + " | Scop Region: " + S->getNameStr()); + // adjust the dominator tree accordingly. + auto *ExitingBlock = StartBlock->getUniqueSuccessor(); + assert(ExitingBlock); + auto *MergeBlock = ExitingBlock->getUniqueSuccessor(); + assert(MergeBlock); + polly::markBlockUnreachable(*StartBlock, Builder); + polly::markBlockUnreachable(*ExitingBlock, Builder); + auto *ExitingBB = S->getExitingBlock(); + assert(ExitingBB); + + DT->changeImmediateDominator(MergeBlock, ExitingBB); + DT->eraseNode(ExitingBlock); + isl_ast_expr_free(Condition); + isl_ast_node_free(Root); + } else { - Value *RTC = NodeBuilder.createRTC(Condition); - Builder.GetInsertBlock()->getTerminator()->setOperand(0, RTC); + NodeBuilder.addParameters(S->getContext().release()); + Value *RTC = NodeBuilder.createRTC(Condition); + Builder.GetInsertBlock()->getTerminator()->setOperand(0, RTC); - Builder.SetInsertPoint(&*StartBlock->begin()); + Builder.SetInsertPoint(&*StartBlock->begin()); - NodeBuilder.create(Root); + NodeBuilder.create(Root); + } /// In case a sequential kernel has more surrounding loops as any parallel /// kernel, the SCoP is probably mostly sequential. Hence, there is no |