[llvm] [RegAllocFast] Ensure live-in vregs get reloaded after INLINEASM_BR spills (PR #131350)

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 14 14:17:27 PDT 2025


================
@@ -491,6 +493,20 @@ static bool dominates(InstrPosIndexes &PosIndexes, const MachineInstr &A,
   return IndexA < IndexB;
 }
 
+bool RegAllocFastImpl::isInlineAsmBrSpill(const MachineInstr &MI) const {
+  int FI;
+  auto *MBB = MI.getParent();
+  if (MBB->isInlineAsmBrIndirectTarget() && TII->isStoreToStackSlot(MI, FI) &&
+      MFI->isSpillSlotObjectIndex(FI)) {
+    for (const auto &Op : MI.operands())
+      if (Op.isReg() && any_of(MBB->liveins(), [&](const auto &RegP) {
+            return Op.getReg() == RegP.PhysReg;
----------------
qcolombet wrote:

Can't we use `MBB->isLiveIn(Op.getReg())` here instead of `any_of`?

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


More information about the llvm-commits mailing list