@@ -40,7 +40,7 @@ void vset_union(const std::set<Value *> &S1, const std::set<Value *> &S2,
40
40
}
41
41
42
42
namespace llvm {
43
- // / Find the successor instructions of the specified instruction.
43
+
44
44
std::set<Instruction *>
45
45
LivenessAnalysis::getSuccessorInstructions (Instruction *I) {
46
46
Instruction *Term = I->getParent ()->getTerminator ();
@@ -58,12 +58,10 @@ LivenessAnalysis::getSuccessorInstructions(Instruction *I) {
58
58
return SuccInsts;
59
59
}
60
60
61
- // / Replaces the value set behind the pointer `S` with the value set `R` and
62
- // / returns whether the set behind `S` changed.
63
- bool LivenessAnalysis::updateValueSet (std::set<Value *> *S,
64
- const std::set<Value *> R) {
65
- const bool Changed = (*S != R);
66
- *S = R;
61
+ bool LivenessAnalysis::updateValueSet (std::set<Value *> &S,
62
+ const std::set<Value *> &R) {
63
+ const bool Changed = (S != R);
64
+ S = R;
67
65
return Changed;
68
66
}
69
67
@@ -138,22 +136,20 @@ LivenessAnalysis::LivenessAnalysis(Function *Func) {
138
136
for (Instruction *SI : SuccInsts) {
139
137
NewOut.insert (In[SI].begin (), In[SI].end ());
140
138
}
141
- Changed |= updateValueSet (& Out[I], std::move ( NewOut) );
139
+ Changed |= updateValueSet (Out[I], NewOut);
142
140
143
141
// Update in[I].
144
142
std::set<Value *> OutMinusDef;
145
143
vset_difference (Out[I], Defs[I], OutMinusDef);
146
144
147
145
std::set<Value *> NewIn;
148
146
vset_union (Uses[I], OutMinusDef, NewIn);
149
- Changed |= updateValueSet (& In[I], std::move ( NewIn) );
147
+ Changed |= updateValueSet (In[I], NewIn);
150
148
}
151
149
}
152
150
} while (Changed); // Until a fixed-point.
153
151
}
154
152
155
- // / Returns the set of live variables immediately before the specified
156
- // / instruction.
157
153
std::set<Value *> LivenessAnalysis::getLiveVarsBefore (Instruction *I) {
158
154
return In[I];
159
155
}
0 commit comments