[llvm] [InlineSpiller] Check rematerialization before folding operand (PR #134015)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 2 09:47:27 PDT 2025
================
@@ -615,6 +620,23 @@ bool InlineSpiller::canGuaranteeAssignmentAfterRemat(Register VReg,
return true;
}
+/// hasPhysRegAvailable - Check if there is an available physical register for
+/// rematerialization.
+bool InlineSpiller::hasPhysRegAvailable(const MachineInstr &MI) {
+ if (!Order || !Matrix)
+ return false;
+
+ SlotIndex UseIdx = LIS.getInstructionIndex(MI).getRegSlot(true);
+ SlotIndex PrevIdx = UseIdx.getPrevSlot();
+
+ for (MCPhysReg PhysReg : *Order) {
+ if (!Matrix->checkInterference(PrevIdx, UseIdx, PhysReg))
+ return true;
+ }
----------------
weiguozhi wrote:
Do you worry about compile time or something else?
https://github.com/llvm/llvm-project/pull/134015
More information about the llvm-commits
mailing list