[llvm] [RegAlloc][X86] Rematerialization of instructions with physical register (PR #198853)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri May 29 06:17:56 PDT 2026
================
@@ -146,17 +152,44 @@ bool VirtRegAuxInfo::isRematerializable(const LiveInterval &LI,
return true;
}
-bool VirtRegAuxInfo::allUsesAvailableAt(const MachineInstr *MI,
+bool VirtRegAuxInfo::allUsesAvailableAt(const MachineInstr *OrigMI,
SlotIndex UseIdx,
const LiveIntervals &LIS,
const MachineRegisterInfo &MRI,
const TargetInstrInfo &TII) {
- SlotIndex OrigIdx = LIS.getInstructionIndex(*MI).getRegSlot(true);
+ SlotIndex OrigIdx = LIS.getInstructionIndex(*OrigMI).getRegSlot(true);
+ auto MBB = LIS.getMBBFromIndex(UseIdx);
+ MachineInstr *UseMI = LIS.getInstructionFromIndex(UseIdx);
+ MachineBasicBlock::iterator UseIt = UseMI;
+ if (!UseMI) {
+ if (MBB->empty() ||
+ UseIdx < LIS.getInstructionIndex(*MBB->begin()).getBaseIndex())
+ UseIt = MBB->begin();
+ else {
+ UseIt = MBB->end();
+ }
----------------
arsenm wrote:
I'd assume there's a function to do this position check for you; you shouldn't need to worry about empty use blocks?
https://github.com/llvm/llvm-project/pull/198853
More information about the llvm-commits
mailing list