[llvm] Greedy: Take copy hints involving subregisters (PR #159570)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 19 01:54:13 PDT 2025
================
@@ -2387,19 +2387,42 @@ void RAGreedy::initializeCSRCost() {
/// The results are stored into \p Out.
/// \p Out is not cleared before being populated.
void RAGreedy::collectHintInfo(Register Reg, HintsInfo &Out) {
+ const TargetRegisterClass *RC = MRI->getRegClass(Reg);
+
for (const MachineInstr &Instr : MRI->reg_nodbg_instructions(Reg)) {
- if (!TII->isFullCopyInstr(Instr))
+ if (!Instr.isCopy())
continue;
+
// Look for the other end of the copy.
Register OtherReg = Instr.getOperand(0).getReg();
+ unsigned OtherSubReg = Instr.getOperand(0).getSubReg();
+ unsigned SubReg = Instr.getOperand(1).getSubReg();
+
if (OtherReg == Reg) {
OtherReg = Instr.getOperand(1).getReg();
+ OtherSubReg = Instr.getOperand(1).getSubReg();
+ SubReg = Instr.getOperand(0).getSubReg();
if (OtherReg == Reg)
continue;
}
----------------
jayfoad wrote:
This is starting to look ugly so I created #159724 to try to simplify it.
https://github.com/llvm/llvm-project/pull/159570
More information about the llvm-commits
mailing list