Skip to content

Commit 266ef08

Browse files
committed
Add function arguments to the control point live variables set.
Without this, it's possible to crash the trace compiler if a function argument is used directly inside the interpreter loop. (Later this could be optimised by only including arguments which are actually used in the interpreter loop)
1 parent 3b11c63 commit 266ef08

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/lib/Transforms/Yk/ControlPoint.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ CallInst *findControlPointCall(Module &M) {
9292
std::vector<Value *> getLiveVars(DominatorTree &DT, CallInst *OldCtrlPoint) {
9393
std::vector<Value *> Vec;
9494
Function *Func = OldCtrlPoint->getFunction();
95+
96+
// Add function arguments to the live set.
97+
for (Value &Arg : Func->args()) {
98+
Vec.push_back(&Arg);
99+
}
100+
101+
// Then add anything which dominates the control point to the live set.
95102
for (auto &BB : *Func) {
96103
if (!DT.dominates(cast<Instruction>(OldCtrlPoint), &BB)) {
97104
for (auto &I : BB) {

0 commit comments

Comments
 (0)