[PATCH] D26169: [Reassociate] Skip reassociation for IV if its def instruction contains NSW/NUW flags to enable better IndVar and LSR

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 9 10:03:10 PST 2016


On Tue, Nov 8, 2016 at 6:56 PM, Sanjoy Das
<sanjoy at playingwithpointers.com> wrote:
> sanjoy requested changes to this revision.
> sanjoy added a comment.
> This revision now requires changes to proceed.
>
> This can potentially be a compile time issue.  I think the SCEV dependency itself is fine, since SCEV will do things lazily, but computing the LoopInfo can be a problem.

We may not increase compile time with reassociate pass computing LoopInfo.

Existing pass ordering is:
Reassociate
Natural Loop Information
Rotate Loops
Loop Invariant Code Motion

Changed pass ordering is:
Natural Loop Information
Rotate Loops
Reassociate
Loop Invariant Code Motion

We know LICM pass will recompute LoopInfo and use it anyway in
existing pipeline. After the pass ordering change, if only Reassociate
preserves LoopInfo, LICM doesn't have to recompute the LoopInfo again.
So in reality we don't increase compile time by computing LoopInfo in
Reassociate pass.

>
> Can this be solved by some changes to our pass order?  I.e. first run indvars and then re-associate?
>

I feel that sinking reassociate to be after indvars is unacceptable
because LICM needs to be after reassociate to find more loop invariant
exprs.
I am hesitate about promoting indvars to be before reassociate
because I am not sure whether there is any impact to change the order
of LICM and indvars.

Thanks,
Wei.


More information about the llvm-commits mailing list