Remix.run Logo
blakepelton 14 hours ago

"Favor the one with lower register pressure" - my mental model says that register pressure is not a property of a single instruction, but rather depends on when successor instructions will be scheduled.

For example, if an instruction defines a value which has 8 uses, then the "register pressure of the instruction" depends on when those 8 uses will be scheduled.

I guess there is a heuristic to compute the register pressure of an instruction based on a guess of when successors will be scheduled?

mshockwave 8 hours ago | parent [-]

yes, the short answer is LLVM uses RegPressureTracker (https://llvm.org/doxygen/classllvm_1_1RegPressureTracker.htm...) to do all those calculations. Slightly longer answer: I should probably be a little more specific that in most cases, Machine Scheduler cares more about register pressure _delta_ caused by a single instruction, either traverses from bottom-up or top-down. In which case it's easier to make an estimation when some of other instructions are not scheduled yet.