[PATCH] D94949: [AArch64][RegAllocFast] Add findSpillBefore to TargetRegisterInfo
Tomas Matheson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 17 06:40:20 PDT 2021
tmatheson added inline comments.
================
Comment at: llvm/lib/CodeGen/RegAllocFast.cpp:1098
+ // bundle like an early-clobber.
+ const bool IsBundle = MI.getOpcode() == TargetOpcode::BUNDLE;
+
----------------
foad wrote:
> Naive question: shouldn't whatever added the operands to the BUNDLE have set the IsEarlyClobber flag appropriately, so you don't need to special-case bundles here?
I looked into that, specifically marking any defs which are followed by any use inside the bundle as early-clobber. For example, you might have a bundle that defines %1 and then uses %2. The idea being that RegAllocFast sees only the bundle instruction, and within the bundle these defs/uses act like early-clobbers in that the def must have it's own separate register.
This works well for RegAllocFast, but RegAllocGreedy actually looks at the live ranges, which do not see bundles. At some point it would hit an assertion failure because it would see an early-clobber register (on the bundle instruction) who's live range didn't start at an early-clobber slot (because it was copied from the instruction inside the bundle and started at the `r` slot).
Trying to avoid this problem seemed like it would require breaking the live ranges semantics and didn't seem like a good path to go down.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94949/new/
https://reviews.llvm.org/D94949
More information about the llvm-commits
mailing list