Skip to content

Commit cbc1241

Browse files
committed
[region-isolation] Eliminate unnecessary helper.
SILValues always have a SILType... so just use getType().isAddress().
1 parent a8886e7 commit cbc1241

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/SILOptimizer/Mandatory/SendNonSendable.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,12 @@ static bool SILApplyCrossesIsolation(const SILInstruction *inst) {
4949
return false;
5050
}
5151

52-
static bool isAddress(SILValue val) {
53-
return val->getType() && val->getType().isAddress();
54-
}
55-
5652
static bool isApplyInst(SILInstruction &inst) {
5753
return ApplySite::isa(&inst) || isa<BuiltinInst>(inst);
5854
}
5955

6056
static AccessStorage getAccessStorageFromAddr(SILValue value) {
61-
assert(isAddress(value));
57+
assert(value->getType().isAddress());
6258
auto accessStorage = AccessStorage::compute(value);
6359
if (accessStorage && accessStorage.getRoot()) {
6460
if (auto definingInst = accessStorage.getRoot().getDefiningInstruction()) {
@@ -72,7 +68,7 @@ static AccessStorage getAccessStorageFromAddr(SILValue value) {
7268
}
7369

7470
static SILValue getUnderlyingTrackedValue(SILValue value) {
75-
if (!isAddress(value)) {
71+
if (!value->getType().isAddress()) {
7672
return getUnderlyingObject(value);
7773
}
7874

@@ -355,9 +351,9 @@ class PartitionOpTranslator {
355351
self->stateIndexToEquivalenceClass[iter.first->second.getID()] = value;
356352
#endif
357353

358-
// Otherwise, we need to compute our true aliased and sendable values. Begi
359-
// by seeing if we have a value that we can prove is not aliased.
360-
if (isAddress(value)) {
354+
// Otherwise, we need to compute our flags. Begin by seeing if we have a
355+
// value that we can prove is not aliased.
356+
if (value->getType().isAddress()) {
361357
if (auto accessStorage = AccessStorage::compute(value))
362358
if (accessStorage.isUniquelyIdentified() &&
363359
!capturedUIValues.count(value))

0 commit comments

Comments
 (0)