v2: don't mess up other loops Signed-off-by: Christian König <deathsim...@vodafone.de> --- lib/Target/R600/AMDGPUStructurizeCFG.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/Target/R600/AMDGPUStructurizeCFG.cpp b/lib/Target/R600/AMDGPUStructurizeCFG.cpp index 22338b5..5be40de 100644 --- a/lib/Target/R600/AMDGPUStructurizeCFG.cpp +++ b/lib/Target/R600/AMDGPUStructurizeCFG.cpp @@ -252,6 +252,11 @@ void AMDGPUStructurizeCFG::analyzeBlock(BasicBlock *BB) { BBPredicates &Pred = Predicates[BB]; for (; PI != PE; ++PI) { + + // Ignore self loops + if (*PI == BB) + continue; + BranchInst *Term = cast<BranchInst>((*PI)->getTerminator()); for (unsigned i = 0, e = Term->getNumSuccessors(); i != e; ++i) { @@ -296,7 +301,9 @@ void AMDGPUStructurizeCFG::collectInfos() { LoopPred.clear(); RNVector::reverse_iterator OI = Order.rbegin(), OE = Order.rend(); - for (Visited.clear(); OI != OE; Visited[(*OI++)->getEntry()] = ++Number) { + for (Visited.clear(); OI != OE; ++OI) { + + Visited[(*OI)->getEntry()] = ++Number; // Analyze all the conditions leading to a node analyzeBlock((*OI)->getEntry()); @@ -568,6 +575,8 @@ void AMDGPUStructurizeCFG::createFlow() { Predicates[Split] = Predicates[Prev]; Order.push_back(ParentRegion->getBBNode(Split)); LoopPred[Prev] = BoolTrue; + if (LoopEnd == Prev) + LoopEnd = Split; } else if (LoopStart == Order.back()->getEntry()) { // Loop starts behind entry, split entry so that we can jump to it -- 1.7.10.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev