[llvm] [VPlan] Use ResumePhi to create reduction resume phis. (PR #110004)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 25 01:26:29 PDT 2024


ayalz wrote:

> > Would be good to clarify various related aspects, such as where ResumePhi's already appear, if this patch is the first to populate the scalar pre-header with recipes, why handling the reduction of epilog loop requires special attention.
> 
> 
> 
> Thanks, updated the description. This follows https://github.com/llvm/llvm-project/commit/9a5a8731e77bb61c64d400a828dc215dc80fb839 which added ResumePHIs for FOR resume values to the scalar preheader. Epilogue needs special attention, as it needs extra incoming values from the bypass blocks.

Excellent.
Trying to further clarify: when main loop was vectorized, it connects to scalar preheader phi incoming from bypasses, and from its middle block (so no further processing is needed when epilog isn't vectorized). When epilog loop is vectorized, it should add to the scalar preheader phi an incoming from its middle block? 

Note that similar processing of epilog loop should apply to FORs as well (which were first to use ResumePhi recipes), if/when loops with FORs become subject to epilog vectorization - currently disabled by isCandidateForEpilogueVectorization().

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


More information about the llvm-commits mailing list