aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGen.cpp
diff options
context:
space:
mode:
authorMichael Maitland <michaeltmaitland@gmail.com>2025-04-14 09:58:46 -0400
committerGitHub <noreply@github.com>2025-04-14 09:58:46 -0400
commit74e8f29f3138431abc9b393579733f3bbd0d85d8 (patch)
tree91e3148459ad938d1e1bf1998dd39ffca18eb6ff /llvm/lib/CodeGen/CodeGen.cpp
parentefe9cb0f79a074ab472ec51d8463aac6931d670a (diff)
downloadllvm-74e8f29f3138431abc9b393579733f3bbd0d85d8.zip
llvm-74e8f29f3138431abc9b393579733f3bbd0d85d8.tar.gz
llvm-74e8f29f3138431abc9b393579733f3bbd0d85d8.tar.bz2
[RegAlloc] Sort CopyHint by IsCSR (#131046)
`weightCalcHelper` is responsible for adding hints to MRI. Prior to this PR, we fell back on register ID as the last tie breaker for sorting hints. However, there is an opportunity to add an additional sorting characteristic: whether or not a register is a callee-saved-register. I thought of this idea because I saw that `AllocationOrder::create` calls `RegisterClassInfo::getOrder`, which returns a list of registers such that the registers which alias callee-saved-registers come last. From this, I conclude that the register allocator prefers an order such that callee-saved-registers are allocated after non-callee-saved-registers to avoid having to spill the CSR. This sorting characteristic occurs only as a tie breaker to the Weight calculation. This is a good idea since the weight calculation is pretty complex and I'm sure it is a pretty stable metric. I think its pretty reasonable to agree that whether a register is callee-saved or not is a better tie breaker than register ID. I think this is evident by the test diff, since the changes all seem to have no impact or improve the register allocation.
Diffstat (limited to 'llvm/lib/CodeGen/CodeGen.cpp')
0 files changed, 0 insertions, 0 deletions