Skip to content

Commit 031255c

Browse files
committed
Rename hasPointerEscape -> findPointerEscape
1 parent 76a8f0c commit 031255c

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

include/swift/SIL/OwnershipUtils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ inline bool isForwardingConsume(SILValue value) {
9090
// Ownership Def-Use Utilities
9191
//===----------------------------------------------------------------------===//
9292

93-
bool hasPointerEscape(BorrowedValue value);
93+
bool findPointerEscape(BorrowedValue value);
9494

9595
/// Whether the specified OSSA-lifetime introducer has a pointer escape.
9696
///
9797
/// precondition: \p value introduces an OSSA-lifetime, either a BorrowedValue
9898
/// can be constructed from it or it's an owned value
99-
bool hasPointerEscape(SILValue value);
99+
bool findPointerEscape(SILValue value);
100100

101101
/// Find leaf "use points" of \p guaranteedValue that determine its lifetime
102102
/// requirement. Return true if no PointerEscape use was found.

lib/SIL/Utils/OwnershipUtils.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
using namespace swift;
2727

28-
bool swift::hasPointerEscape(BorrowedValue original) {
28+
bool swift::findPointerEscape(BorrowedValue original) {
2929
ValueWorklist worklist(original->getFunction());
3030
worklist.push(*original);
3131

@@ -68,9 +68,9 @@ bool swift::hasPointerEscape(BorrowedValue original) {
6868
return false;
6969
}
7070

71-
bool swift::hasPointerEscape(SILValue original) {
71+
bool swift::findPointerEscape(SILValue original) {
7272
if (auto borrowedValue = BorrowedValue(original)) {
73-
return hasPointerEscape(borrowedValue);
73+
return findPointerEscape(borrowedValue);
7474
}
7575
assert(original->getOwnershipKind() == OwnershipKind::Owned);
7676

@@ -2312,27 +2312,27 @@ bool swift::isRedundantMoveValue(MoveValueInst *mvi) {
23122312
//
23132313
// Check this in two ways, one cheaper than the other.
23142314

2315-
// First, avoid calling hasPointerEscape(original).
2315+
// First, avoid calling findPointerEscape(original).
23162316
//
23172317
// If the original value is not a phi (a phi's incoming values might have
23182318
// escaping uses) and its only user is the move, then it doesn't escape. Also
23192319
// if its only user is the move, then its only _consuming_ user is the move.
23202320
auto *singleUser =
23212321
original->getSingleUse() ? original->getSingleUse()->getUser() : nullptr;
23222322
if (mvi == singleUser && !SILArgument::asPhi(original)) {
2323-
assert(!hasPointerEscape(original));
2323+
assert(!findPointerEscape(original));
23242324
assert(original->getSingleConsumingUse()->getUser() == mvi);
23252325
// - !escaping(original)
23262326
// - singleConsumingUser(original) == move
23272327
return true;
23282328
}
23292329

2330-
// Second, call hasPointerEscape(original).
2330+
// Second, call findPointerEscape(original).
23312331
//
23322332
// Explicitly check both
23332333
// - !escaping(original)
23342334
// - singleConsumingUser(original) == move
2335-
auto originalHasEscape = hasPointerEscape(original);
2335+
auto originalHasEscape = findPointerEscape(original);
23362336
auto *singleConsumingUser = original->getSingleConsumingUse()
23372337
? original->getSingleConsumingUse()->getUser()
23382338
: nullptr;
@@ -2341,6 +2341,6 @@ bool swift::isRedundantMoveValue(MoveValueInst *mvi) {
23412341
}
23422342

23432343
// (3) Escaping matches? (Expensive check, saved for last.)
2344-
auto moveHasEscape = hasPointerEscape(mvi);
2344+
auto moveHasEscape = findPointerEscape(mvi);
23452345
return moveHasEscape == originalHasEscape;
23462346
}

lib/SILOptimizer/SemanticARC/CopyValueOpts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ static bool tryJoinIfDestroyConsumingUseInSameBlock(
511511
// Check whether the uses considered immediately above are all effectively
512512
// instantaneous uses. Pointer escapes propagate values ways that may not be
513513
// discoverable.
514-
if (hasPointerEscape(operand)) {
514+
if (findPointerEscape(operand)) {
515515
return false;
516516
}
517517

lib/SILOptimizer/Transforms/DeadCodeElimination.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ void DCE::markLive() {
277277
case SILInstructionKind::DestroyValueInst: {
278278
auto phi = PhiValue(I.getOperand(0));
279279
// Disable DCE of phis which are lexical or may have a pointer escape.
280-
if (phi && (phi->isLexical() || hasPointerEscape(phi))) {
280+
if (phi && (phi->isLexical() || findPointerEscape(phi))) {
281281
markInstructionLive(&I);
282282
}
283283
// The instruction is live only if it's operand value is also live
@@ -287,7 +287,7 @@ void DCE::markLive() {
287287
case SILInstructionKind::EndBorrowInst: {
288288
auto phi = PhiValue(I.getOperand(0));
289289
// If there is a pointer escape or phi is lexical, disable DCE.
290-
if (phi && (hasPointerEscape(phi) || phi->isLexical())) {
290+
if (phi && (findPointerEscape(phi) || phi->isLexical())) {
291291
markInstructionLive(&I);
292292
}
293293
// The instruction is live only if it's operand value is also live

lib/SILOptimizer/UtilityPasses/UnitTestRunner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ struct OwnershipUtilsHasPointerEscape : UnitTest {
281281
OwnershipUtilsHasPointerEscape(UnitTestRunner *pass) : UnitTest(pass) {}
282282
void invoke(Arguments &arguments) override {
283283
auto value = arguments.takeValue();
284-
auto has = hasPointerEscape(value);
284+
auto has = findPointerEscape(value);
285285
value->print(llvm::errs());
286286
auto *boolString = has ? "true" : "false";
287287
llvm::errs() << boolString << "\n";

0 commit comments

Comments
 (0)