[PATCH] LoopUnroll: Create sub-loops in LoopInfo

Andrew Trick atrick at apple.com
Tue Oct 7 12:07:34 PDT 2014

Thanks Duncan.

SCEV should be fine w.r.t new loops. It has a pretty straight forward cache from SCEV (expression pointer) to Loop + “disposition” (was the expression invariant). If it sees a new loop, it will just recompute the loop disposition.

My only concern here is that we probably need to tell SCEV to forget any inner loop within the unrolled loop (SE->forgetLoop(L)). In most cases this probably isn’t necessary, but I can’t prove to myself that it’s safe since values flowing into the loop have changed. It doesn’t look like we’re doing that. I suggest calling forgetLoop on each “old” inner loop.


> On Oct 6, 2014, at 3:34 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> This fixes the crasher in PR20987 by creating sub-loop info in
> -loop-unroll.
> While the attached patch adds the missing data to `LoopInfo`, I'm not
> sure what the contract is with SCEV (which can have a reference to
> `LoopInfo`).  Have I created a new problem, or does this look okay?
> <0001-LoopUnroll-Create-sub-loops-in-LoopInfo.patch>

More information about the llvm-commits mailing list