[llvm] [VPlan] Try to hoist Previous (and operands), if sinking fails for FORs. (PR #108945)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 21:55:57 PDT 2024


fhahn 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`.

> 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?

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


More information about the llvm-commits mailing list