summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/PPCGCodeGeneration.cpp
diff options
context:
space:
mode:
authorPhilip Pfaffe <philip.pfaffe@gmail.com>2018-03-03 10:47:37 +0000
committerPhilip Pfaffe <philip.pfaffe@gmail.com>2018-03-03 10:47:37 +0000
commita8f7cc8ec98770f3ba6c8794f4723f5eac03b12a (patch)
tree271cb334f310d43c4d89c002e1aebdb4f4d49327 /polly/lib/CodeGen/PPCGCodeGeneration.cpp
parentd4b6601662a8318bdfe9c26ff889dd19c6d745d2 (diff)
downloadbcm5719-llvm-a8f7cc8ec98770f3ba6c8794f4723f5eac03b12a.tar.gz
bcm5719-llvm-a8f7cc8ec98770f3ba6c8794f4723f5eac03b12a.zip
[Acc] Fix for PR33208
During codegen, Polly attempts to clear all loops from ScalarEvolution and LoopInfo, and it does so one block at a time. This causes undefined behaviour, since this way a loop header might be removed from a loop before the entire loop is erased, causing ScalarEvolution to run into an error. Instead, just delete the entire loop atomically. This fixes currently failing testcases. llvm-svn: 326643
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
-rw-r--r--polly/lib/CodeGen/PPCGCodeGeneration.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index 5bf31e60e92..2366b5ec2f8 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -1555,20 +1555,16 @@ void GPUNodeBuilder::clearDominators(Function *F) {
}
void GPUNodeBuilder::clearScalarEvolution(Function *F) {
- for (BasicBlock &BB : *F) {
- Loop *L = LI.getLoopFor(&BB);
+ for (auto *L : LI)
if (L)
SE.forgetLoop(L);
- }
}
void GPUNodeBuilder::clearLoops(Function *F) {
- for (BasicBlock &BB : *F) {
- Loop *L = LI.getLoopFor(&BB);
- if (L)
- SE.forgetLoop(L);
- LI.removeBlock(&BB);
- }
+ clearScalarEvolution(F);
+ SmallVector<Loop *, 1> Loops(LI.begin(), LI.end());
+ for (auto *L : Loops)
+ LI.erase(L);
}
std::tuple<Value *, Value *> GPUNodeBuilder::getGridSizes(ppcg_kernel *Kernel) {
OpenPOWER on IntegriCloud