[llvm] [Passes] Run IndVars after late partial unrolling. (PR #81275)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 06:06:37 PST 2024


fhahn wrote:

> We already run the "core" part of IndVarSimplify via simplifyLoopIVs() in simplifyLoopAfterUnroll(). It sounds like the part you additionally want in your test case is the replaceCongruentIVs() optimization? Would it make more sense to call that from simplifyLoopIVs()?

Yep for the immediate issue yes, let me take a look at that.
> 
> Is your test case representative of the actual optimization you're trying to achieve? It doesn't look very compelling to me, as this seems like the kind of thing that LSR would fix up anyway.

The full motivating test case needs the IVs to be folded to enable removing redundant loads, but for now those are only cleaned up by a follow-up run of GVN, which is far to expensive. So I am still trying to figure out what the best way forward is. Before https://github.com/llvm/llvm-project/commit/aea2a147363197f3cef140ebcd27b534fd41877b this wasn't an issue as those loops would have been unrolled before IndVars/GVN are run.

But we at the moment have the same missed optimizations for runtime unrolling even before https://github.com/llvm/llvm-project/commit/aea2a147363197f3cef140ebcd27b534fd41877b

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


More information about the llvm-commits mailing list