File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -119,13 +119,14 @@ LivenessAnalysis::LivenessAnalysis(Function *Func) {
119
119
}
120
120
}
121
121
122
- // A function implicitly defines its arguments.
123
- //
124
- // To propagate the arguments properly we pretend that the first instruction
125
- // in the entry block defines the arguments.
122
+ // Normally the live range of a variable starts at the instruction that
123
+ // defines it. No instruction defines the function's arguments, but it is
124
+ // important that we don't report them dead. We make function arguments live
125
+ // at the start of the function by adding them into the `In` set of the first
126
+ // instruction.
126
127
Instruction *FirstInst = &*Func->getEntryBlock ().begin ();
127
128
for (auto &Arg : Func->args ())
128
- Defs [FirstInst].insert (&Arg);
129
+ In [FirstInst].insert (&Arg);
129
130
130
131
// Compute the live sets for each instruction.
131
132
//
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class YkStackmaps : public ModulePass {
52
52
if (F.empty ()) // skip declarations.
53
53
continue ;
54
54
LivenessAnalysis LA (&F);
55
- for (BasicBlock &BB : F)
55
+ for (BasicBlock &BB : F) {
56
56
for (Instruction &I : BB) {
57
57
if (isa<CallInst>(I)) {
58
58
CallInst &CI = cast<CallInst>(I);
@@ -78,6 +78,7 @@ class YkStackmaps : public ModulePass {
78
78
SMCalls.insert ({&I, LA.getLiveVarsBefore (&I)});
79
79
}
80
80
}
81
+ }
81
82
}
82
83
83
84
Function *SMFunc = Intrinsic::getDeclaration (&M, SMFuncID);
You can’t perform that action at this time.
0 commit comments