This LoopNestPass-version LIR is currently identical to the LoopPass-version LIR. The
new added pass is added into PassRegistry as "loop-nest-idiom". Following
patches will utilize the LoopNest structure for more efficient optimization.
Hi @fhahn ,
For example, given a perfectly nested loop-pair and we have matched a store operation that we can hoist to the inner-loop's header as strided store operations,
we can further check on the outer-loop, see if the outer-loop SCEV maintains the continuous memory access and hoist the operation one more loop outwards.
Ah I see, so you are planning to add additional optimizations based on LoopNest? If so, I think it would also be good to share a patch that makes implements such an additional optimization so there's a clear path towards concrete improvements and it would also show why using LoopNest is needed/beneficial.
When the loop idiom transformation processes a memset instruction in a loop, currently it only handles the memset with a compile-time constant size. The motivation of this work is to relax this limitation, so that a memset with a variable size in a loop may still be processed and promoted to a larger memset if it passes all the eligibility checks. Performance-wise, promoting the memset in a loop to a larger memset reduces the number of calls to memset; hence reducing the overall call overhead.
A similar technique may also apply to the memcpy with a variable size in a loop.