File tree Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -391,22 +391,20 @@ class PrunedLiveness {
391
391
Ending,
392
392
// The instruction doesn't use the value.
393
393
NonUse,
394
- };
395
- Value value;
394
+ } value;
396
395
397
396
LifetimeEnding (Value value) : value(value) {}
398
- explicit LifetimeEnding (bool lifetimeEnding)
399
- : value(lifetimeEnding ? Value::Ending : Value::NonEnding) {}
400
397
operator Value () const { return value; }
398
+
399
+ static LifetimeEnding forUse (bool lifetimeEnding) {
400
+ return lifetimeEnding ? Value::Ending : Value::NonEnding;
401
+ }
402
+ bool isEnding () const { return value == Value::Ending; }
403
+
401
404
LifetimeEnding meet (LifetimeEnding const other) const {
402
405
return value < other.value ? *this : other;
403
406
}
404
407
void meetInPlace (LifetimeEnding const other) { *this = meet (other); }
405
- bool isEnding () const { return value == Value::Ending; }
406
-
407
- static LifetimeEnding NonUse () { return {Value::NonUse}; };
408
- static LifetimeEnding Ending () { return {Value::Ending}; };
409
- static LifetimeEnding NonEnding () { return {Value::NonEnding}; };
410
408
};
411
409
412
410
protected:
@@ -467,8 +465,8 @@ class PrunedLiveness {
467
465
auto useIter = users.find (user);
468
466
if (useIter == users.end ())
469
467
return NonUser;
470
- return useIter->second == LifetimeEnding::Ending () ? LifetimeEndingUse
471
- : NonLifetimeEndingUse;
468
+ return useIter->second . isEnding () ? LifetimeEndingUse
469
+ : NonLifetimeEndingUse;
472
470
}
473
471
474
472
using ConstUserRange =
Original file line number Diff line number Diff line change @@ -216,12 +216,12 @@ void PrunedLiveRange<LivenessWithDefs>::updateForUse(
216
216
template <typename LivenessWithDefs>
217
217
void PrunedLiveRange<LivenessWithDefs>::updateForUse(SILInstruction *user,
218
218
bool lifetimeEnding) {
219
- updateForUse (user, LifetimeEnding (lifetimeEnding));
219
+ updateForUse (user, LifetimeEnding::forUse (lifetimeEnding));
220
220
}
221
221
222
222
template <typename LivenessWithDefs>
223
223
void PrunedLiveRange<LivenessWithDefs>::extendToNonUse(SILInstruction *inst) {
224
- updateForUse (inst, LifetimeEnding::NonUse () );
224
+ updateForUse (inst, LifetimeEnding::Value:: NonUse);
225
225
}
226
226
227
227
template <typename LivenessWithDefs>
You can’t perform that action at this time.
0 commit comments