[llvm] [LoopUnroll] Add CSE to remove redundant loads after unrolling. (PR #83860)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 03:00:30 PST 2024


fhahn wrote:

> what about conditionally running EarlyCSE if LoopUnroll made a change?
> I guess that would be extending #81275 to also run EarlyCSE

That would be another option, but I think we would need a loop-only version of EarlyCSE to avoid unnecessary compile-time increases. Also, regular EarlyCSE is not enough to eliminate loads that become redundant across unrolled iterations; to do that, this patch uses SCEV expressions as key to handle pointers from different iterations (which are equal due to different offsets).

Happy to go down that route if we agree in general that we want to handle such cases by running (sets of) passes depending on results from earlier passes. I think overall that would be preferable, as it makes it easier to independently test those extra passes.


https://github.com/llvm/llvm-project/pull/83860


More information about the llvm-commits mailing list