Skip to content

Commit 2571222

Browse files
committed
Apply stackmap mappings transitively.
If a register has a mapping and is then mapped to a new register, apply the same mapping to the new register. This means, that stack spills moved into one register and then into another will continued to be tracked. While we are here, remove an old and now irrelevant comment.
1 parent 2acbfa1 commit 2571222

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

llvm/lib/Target/X86/X86AsmPrinter.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,17 @@ void processInstructions(
9797
const MachineOperand Rhs = Instr.getOperand(1);
9898
assert(Lhs.isReg() && "Is register.");
9999
assert(Rhs.isReg() && "Is register.");
100-
SpillMap[Lhs.getReg()] = Rhs.getReg();
100+
if (SpillMap.count(Rhs.getReg()) > 0) {
101+
// If the RHS has a mapping, apply the same mapping to the new register.
102+
// This means, that stack spills moved into one register and then into
103+
// another will continued to be tracked.
104+
SpillMap[Lhs.getReg()] = SpillMap[Rhs.getReg()];
105+
} else {
106+
SpillMap[Lhs.getReg()] = Rhs.getReg();
107+
}
108+
// YKFIXME: If the `mov` instruction has a killed-flag, remove the
109+
// register from the map.
110+
101111
// Reassigning a new value to Lhs means any mappings to Lhs are now void
102112
// and need to be removed.
103113
clearRhs(Lhs.getReg(), SpillMap);

llvm/lib/Transforms/Yk/ControlPoint.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,6 @@ class YkControlPoint : public ModulePass {
220220
// Replace the call to the dummy control point.
221221
OldCtrlPointCall->eraseFromParent();
222222

223-
// Get the result of the control point call. If it returns true, that means
224-
// the stopgap interpreter has interpreted a return so we need to return as
225-
// well.
226-
227223
// Create the new exit block.
228224
BasicBlock *ExitBB = BasicBlock::Create(Context, "", Caller);
229225
Builder.SetInsertPoint(ExitBB);

0 commit comments

Comments
 (0)