[llvm] [LoopUnroll] Introduce parallel reduction phis when unrolling. (PR #149470)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 25 07:28:56 PDT 2025
fhahn wrote:
> Should this be enabled or not at optsize/minsize (as in instr-size-costs.ll)? And should it be disabled for all the cases where it is not expected to be profitable? For any in-order core for example I believe this will just add extra instructions for likely no extra benefit? I may be mistaken about what exactly it does.
Yep, this will only be beneficial for cores that have enough execution units to execute multiple chains of reductions in parallel. for now I added a flag to control the behavior in this patch (off-by-default). As part of https://github.com/llvm/llvm-project/pull/149699, I'll add a new variable to unrolling preference, so targets can enable it.
I've not added any checks for optsize/minsize for now. If we decided to unroll with those attributes, the few extra instructions probably won't make a big difference and targets must opt in anyways. One common case for unrolling with opt-size/minsize is when unrolling is forced via pragmas, in which case the user probably care about peformance.
https://github.com/llvm/llvm-project/pull/149470
More information about the llvm-commits
mailing list