Skip to content

Commit ac763c1

Browse files
committed
Make new stackmaps in the form LLVM expects.
LLVM's stackmap lowering pass expects a stackmap's operands to end with StackMaps::NextLive, unless the last operand is an implicit register. If we just happened to have updated the last operand with a spill reload we need make sure to add StackMaps::NextLive to the end.
1 parent e3a83eb commit ac763c1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/CodeGen/Yk/FixStackmapsSpillReloads.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ bool FixStackmapsSpillReloads::runOnMachineFunction(MachineFunction &MF) {
190190
}
191191
MOI++;
192192
}
193+
MachineOperand *Last = NewMI->operands_end() - 1;
194+
if (!Last->isReg() || !Last->isImplicit()) {
195+
// Unless the last operand is an implicit register, the last operand
196+
// needs to be `NextLive` due to the way stackmaps are parsed.
197+
MIB.addImm(StackMaps::NextLive);
198+
}
193199
// Insert the new stackmap instruction just after the last call.
194200
MI.getParent()->insertAfter(LastCall, NewMI);
195201
// Remember the old stackmap instruction for deletion later.

0 commit comments

Comments
 (0)