[PATCH] D22630: Loop rotation
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 26 15:06:17 PDT 2016
eli.friedman added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/LoopRotation.cpp:431
@@ +430,3 @@
+ DEBUG(dbgs() << "\nSplitting the edge of Loop:"; L->dumpVerbose(););
+ LoopLatch = SplitEdge(LoopLatch, L->getHeader(), DT, LI);
+ }
----------------
sebpop wrote:
> hiraditya wrote:
> > eli.friedman wrote:
> > > The loop latch could be an indirectbr.
> > I'll fix this, thanks.
> I have the impression that the loop analysis will not find a natural loop if the edge from the latch to the header is an indirect branch.
> Are you sure this is possible? Do you have a test-case where we recognize a loop with an indirect branch for the latch edge?
indirectbr loop in C:
int g(), h(), z();
int f() {
static void* x[] = {&&F, &&G, &&H};
F:
goto *x[z()];
G: return g();
H: return h();
}
`clang -x c - -o - -S -O2 -emit-llvm | opt -analyze -loops` gives:
Printing analysis 'Natural Loop Information' for function 'f':
Loop at depth 1 containing: %F<header><latch><exiting>
https://reviews.llvm.org/D22630
More information about the llvm-commits
mailing list