I see that there are several options to influence instruction scheduling, but there doesn’t seem to be a lot of information about what they do, for example:
The description in MachineScheduler.cpp says:
“Force top-down list scheduling” and “Force bottom-up list scheduling”
Which isn’t too helpful - where might I want to use these? Under what conditions might they improve an instruction schedule?
Similar questions for the instruction scheduler strategies:
ilpmax, ilpmin, or shuffle)
And for the analysis heuristics:
-misched-cyclicpath, -misched-regpressure, and -misched-
Are these things mutually exclusive or can they be combined? What combination will give the most rigorous analysis and improve scheduling (at the cost of longer runtime of llc)
As a follow on question: which of these options are already enabled when compiling with -O3?
I think those should be considered internal options for (llvm codegen) developers, a normal compiler user should not need to use any of them. Of course you can look around the llvm sourcecode (esp. in lib/CodeGen/MachineScheduler.cpp) and see what cl::opt options are available and how they affect the scheduler operation.
In case of the MachineScheduler all settings are the same regardless of the optimisation level, however the MachineScheduler is disabled as a whole in TargetPassConfig.cpp when optimized regalloc is not enabled (which I believe happens for everything except -O0).
I think those should be considered internal options for (llvm codegen)
developers, a normal compiler user should not need to use any of them.
We're targetting a new processor. I'm trying to get IPC numbers up a bit by
trying to figure out how to improve scheduling for our particular
architecture. If it turns out that some of these options give us
improvements I can have them be 'on' by default for our target.
LLVM targets have other options available to influence the scheduling: From enabling the machine scheduler at all (see TargetSubtargetInfo), to providing a SchedPolicy implementation, providing a scheduling model up to using the MachineScheduler framework to develop your own variant. MachineScheduler.h has a bunch of documentation at the beginning.
Thanks for that SchedPolicy info. Setting Policy.ShouldTrackPressure = true seems to be giving much improved results.