[PATCH] D144907: [RegAllocFast] insert additional spills along indirect edges of INLINEASM_BR
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 1 15:27:52 PST 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9cec2b246e71: [RegAllocFast] insert additional spills along indirect edges of INLINEASM_BR (authored by nickdesaulniers).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144907/new/
https://reviews.llvm.org/D144907
Files:
llvm/lib/CodeGen/RegAllocFast.cpp
llvm/test/CodeGen/X86/callbr-asm-outputs-regallocfast.mir
Index: llvm/test/CodeGen/X86/callbr-asm-outputs-regallocfast.mir
===================================================================
--- llvm/test/CodeGen/X86/callbr-asm-outputs-regallocfast.mir
+++ llvm/test/CodeGen/X86/callbr-asm-outputs-regallocfast.mir
@@ -135,8 +135,9 @@
; CHECK-NEXT: {{ $}}
; CHECK-NEXT: bb.3.label.split (machine-block-address-taken, inlineasm-br-indirect-target):
; CHECK-NEXT: successors: %bb.2(0x80000000)
+ ; CHECK-NEXT: liveins: $eax
; CHECK-NEXT: {{ $}}
- ; FIXME: this is a load from a stack slot that hasn't been stored to yet!
+ ; CHECK-NEXT: MOV32mr %stack.3, 1, $noreg, 0, $noreg, $eax :: (store (s32) into %stack.3)
; CHECK-NEXT: $eax = MOV32rm %stack.3, 1, $noreg, 0, $noreg :: (load (s32) from %stack.3)
; CHECK-NEXT: MOV32mr %stack.1.x, 1, $noreg, 0, $noreg, killed renamable $eax :: (store (s32) into %ir.x)
; CHECK-NEXT: JMP_1 %bb.2
Index: llvm/lib/CodeGen/RegAllocFast.cpp
===================================================================
--- llvm/lib/CodeGen/RegAllocFast.cpp
+++ llvm/lib/CodeGen/RegAllocFast.cpp
@@ -948,6 +948,23 @@
<< LRI->Reloaded << '\n');
bool Kill = LRI->LastUse == nullptr;
spill(SpillBefore, VirtReg, PhysReg, Kill, LRI->LiveOut);
+
+ // We need to place additional spills for each indirect destination of an
+ // INLINEASM_BR.
+ if (MI.getOpcode() == TargetOpcode::INLINEASM_BR) {
+ int FI = StackSlotForVirtReg[VirtReg];
+ const TargetRegisterClass &RC = *MRI->getRegClass(VirtReg);
+ for (MachineOperand &MO : MI.operands()) {
+ if (MO.isMBB()) {
+ MachineBasicBlock *Succ = MO.getMBB();
+ TII->storeRegToStackSlot(*Succ, Succ->begin(), PhysReg, Kill,
+ FI, &RC, TRI, VirtReg);
+ ++NumStores;
+ Succ->addLiveIn(PhysReg);
+ }
+ }
+ }
+
LRI->LastUse = nullptr;
}
LRI->LiveOut = false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144907.501684.patch
Type: text/x-patch
Size: 1977 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230301/81b25402/attachment.bin>
More information about the llvm-commits
mailing list