Skip to content

Commit 5f36f1f

Browse files
bors[bot]vext01
andauthored
72: A couple of misc bits in ykllvm r=ltratt a=vext01 Co-authored-by: Edd Barrett <[email protected]>
2 parents 9c9f169 + a26b3f4 commit 5f36f1f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

llvm/lib/Transforms/Yk/LivenessAnalysis.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff 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
//

llvm/lib/Transforms/Yk/StackMaps.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)