diff options
| author | Siddharth Bhat <siddu.druid@gmail.com> | 2017-07-14 10:00:25 +0000 |
|---|---|---|
| committer | Siddharth Bhat <siddu.druid@gmail.com> | 2017-07-14 10:00:25 +0000 |
| commit | 03346c270129145e8d3123cffdbddc3297a1052a (patch) | |
| tree | 75080680be61bf6da27adf93652ffc78829cbfe1 /polly/lib/CodeGen/PPCGCodeGeneration.cpp | |
| parent | 87a70679831b185cc21f9c9dca07d98ac95b1207 (diff) | |
[PPCGCodeGeneration] Fix runtime check adjustments since they make assumptions about BB layout.
- There is a conditional branch that is used to switch between the old
and new versions of the code.
- If we detect that the build was unsuccessful, `PPCGCodeGeneration` will
change the runtime check to be always set to false.
- To actually *reach* this runtime check instruction, `PPCGCodeGeneration`
was using assumptions about the layout of the BBs.
- However, invariant load hoisting violates this assumption by inserting
an extra basic block in the middle.
- Fix the assumption on the layout by having `createScopConditionally`
return the conditional branch instruction.
- Use this reference to set to always-false.
llvm-svn: 308010
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
| -rw-r--r-- | polly/lib/CodeGen/PPCGCodeGeneration.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index 7b096a1917a2..6ccf78748cc7 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -2935,10 +2935,14 @@ 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. - BBPair StartExitBlocks = + BBPair StartExitBlocks; + BranchInst *CondBr = nullptr; + std::tie(StartExitBlocks, CondBr) = executeScopConditionally(*S, Builder.getTrue(), *DT, *RI, *LI); BasicBlock *StartBlock = std::get<0>(StartExitBlocks); + assert(CondBr && "CondBr not initialized by executeScopConditionally"); + GPUNodeBuilder NodeBuilder(Builder, Annotator, *DL, *LI, *SE, *DT, *S, StartBlock, Prog, Runtime, Architecture); @@ -2966,10 +2970,10 @@ public: /// kernel, the SCoP is probably mostly sequential. Hence, there is no /// point in running it on a GPU. if (NodeBuilder.DeepestSequential > NodeBuilder.DeepestParallel) - SplitBlock->getTerminator()->setOperand(0, Builder.getFalse()); + CondBr->setOperand(0, Builder.getFalse()); if (!NodeBuilder.BuildSuccessful) - SplitBlock->getTerminator()->setOperand(0, Builder.getFalse()); + CondBr->setOperand(0, Builder.getFalse()); } bool runOnScop(Scop &CurrentScop) override { |
