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) {
119119 }
120120 }
121121
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.
126127 Instruction *FirstInst = &*Func->getEntryBlock ().begin ();
127128 for (auto &Arg : Func->args ())
128- Defs [FirstInst].insert (&Arg);
129+ In [FirstInst].insert (&Arg);
129130
130131 // Compute the live sets for each instruction.
131132 //
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class YkStackmaps : public ModulePass {
5252 if (F.empty ()) // skip declarations.
5353 continue ;
5454 LivenessAnalysis LA (&F);
55- for (BasicBlock &BB : F)
55+ for (BasicBlock &BB : F) {
5656 for (Instruction &I : BB) {
5757 if (isa<CallInst>(I)) {
5858 CallInst &CI = cast<CallInst>(I);
@@ -78,6 +78,7 @@ class YkStackmaps : public ModulePass {
7878 SMCalls.insert ({&I, LA.getLiveVarsBefore (&I)});
7979 }
8080 }
81+ }
8182 }
8283
8384 Function *SMFunc = Intrinsic::getDeclaration (&M, SMFuncID);
You can’t perform that action at this time.
0 commit comments