[PATCH] D18712: [LoopUnroll] Fix the way we update DT after complete unrolling.
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 5 14:37:03 PDT 2016
sanjoy added a comment.
Hi Michael,
I don't quite grok this statement "That set is a superset of
exit-blocks set.". What if we have
maybe_goto exit0;
for (...)
if (cond) {
// block a
maybe_goto exit0;
} else {
maybe_goto exit1;
}
}
exit0:
return
exit1:
return
The set of dominance children of exiting blocks of the above loop is
{exit1}, but the set of exit blocks is {exit0, exit1} (so the set of
dominance children of exiting blocks is not a superset of the exit
blocks of the loop). Is there some additional invariant that applies
to unrolled loops that I'm missing here?
================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:559
@@ -556,6 +558,3 @@
if (DT && Count > 1) {
- for (auto Exit : ExitBlocks) {
- BasicBlock *PrevIDom = DT->getNode(Exit)->getIDom()->getBlock();
- BasicBlock *NewIDom =
- DT->findNearestCommonDominator(PrevIDom, Latches[0]);
- DT->changeImmediateDominator(Exit, NewIDom);
+ for (auto BB : ExitingBlocks) {
+ auto *BBDomNode = DT->getNode(BB);
----------------
Use `auto *` here and below (to make it obvious that you're binding to a pointer).
http://reviews.llvm.org/D18712
More information about the llvm-commits
mailing list