[llvm] [MachineScheduler] Add option to control reordering for store/load clustering (PR #75338)

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 05:46:17 PST 2024


asb wrote:

> Are you saying that reordering the instructions to match the order in MemOpInfo is positively desirable in some cases? I only disabled it because it seemed completely arbitrary to me.

It's definitely somewhat arbitrary. I don't see it being harmful though, and it's attractive to me that the same sorting is used for clustering in the MachineScheduler as for the SelectionDAG (which also sorts in increasing order of offset in ScheduleDAGSDNodes::ClusterNeighbouringLoads). As a reader of the generated assembly, if the order of neighbouring loads is unimportant then I also have a slight preference for them being in sorted order as that's clearly arbitrary, while unsorted has the false appearance of being meaningful.

I'd say matching the SDag scheduler is the main one that motivated bothering to patch this - having the same order makes it easier to compare what missed opportunities / differences there are when enabling load clustering there as well.

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


More information about the llvm-commits mailing list