[llvm] [AArch64] Follow-up from #166926 (PR #167480)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 11 05:07:02 PST 2025


================
@@ -1168,26 +1171,33 @@ bool AArch64RegisterInfo::getRegAllocationHints(
           TII->get(AArch64::getSVEPseudoMap(Def.getOpcode())).TSFlags;
 
       for (MCPhysReg R : Order) {
-        auto AddHintIfSuitable = [&](MCPhysReg R, const MachineOperand &MO) {
-          // R is a suitable register hint if there exists an operand for the
-          // instruction that is not yet allocated a register or if R matches
-          // one of the other source operands.
-          if (!VRM->hasPhys(MO.getReg()) || VRM->getPhys(MO.getReg()) == R)
+        auto AddHintIfSuitable = [&](MCPhysReg R,
+                                     const MachineOperand &MO) -> bool {
+          // R is a suitable register hint if:
+          // * R is one of the source operands.
+          // * The register allocator has not suggested any hints and one of the
+          //   instruction's source operands does not yet have a register
+          //   allocated for it.
+          if (VRM->getPhys(MO.getReg()) == R ||
+              (!VRM->hasPhys(MO.getReg()) && Hints.empty())) {
----------------
sdesmalen-arm wrote:

Good point, after moving the call to `TargetRegisterInfo::getRegAllocationHints` earlier this no longer seems to be required.

https://github.com/llvm/llvm-project/pull/167480


More information about the llvm-commits mailing list