[llvm] [VPlan] Try to hoist Previous (and operands), if sinking fails for FORs. (PR #108945)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 22 08:20:28 PDT 2024
ayalz wrote:
> (forgot to respond to the comments here when responding to the inline comments/updating the patch)
>
> > Nice extension!
> > Would be good to also check recurrences of order greater than 1 - finding first non-phi 'previous' should work for hoisting as it does for sinking.
>
> I _think_ that should already be done, the loop to look for the first non-phi previous is just above the call to `sinkRecurrenceUsersAfterPrevious`/`hoistPreviousBeforeFORUsers`.
Agreed, hence "should work", suggestion is to "also check", i.e., add tests if needed.
>
> > Curious if there are cases where sinking all users or hoisting previous along with all relevant operands fail, but some code motion in both directions succeeds, possibly with multiple FORs. A general approach would be to add dependences between users and previous of each FOR (possibly also with splices introduced), and then topologically sort the data-dependence graph having all dependences - included memory based ones. Handling each FOR separately by either only sinking its users or only hoisting its previous might be too restricted.
>
> There probably are such cases, which would have the potential for another follow-up?
Sure, by all means, potentially starting with tests demonstrating such cases.
https://github.com/llvm/llvm-project/pull/108945
More information about the llvm-commits
mailing list