Skip to content

Commit 76a8f0c

Browse files
committed
Remove old hack in transitive address use walker for store_borrow
Now that store_borrows are represented correctly, remove this hack.
1 parent f9abb02 commit 76a8f0c

File tree

3 files changed

+2
-18
lines changed

3 files changed

+2
-18
lines changed

lib/SIL/Utils/AddressWalker.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ AddressUseKind TransitiveAddressWalker::walk(SILValue projectedAddress) && {
2525
// When we exit, set the result to be invalidated so we can't use this again.
2626
SWIFT_DEFER { didInvalidate = true; };
2727

28-
// If the projectedAddress is dead, it is itself a leaf use. Since we don't
29-
// have an operand for it, simply bail. Dead projectedAddress is unexpected.
30-
//
31-
// TODO: store_borrow is currently an InteriorPointer with no uses, so we end
32-
// up bailing. It should be in a dependence scope instead. It's not clear why
33-
// it produces an address at all.
34-
if (projectedAddress->use_empty()) {
35-
return AddressUseKind::PointerEscape;
36-
}
37-
3828
StackList<Operand *> worklist(projectedAddress->getFunction());
3929
SmallPtrSet<Operand *, 32> visitedOperands;
4030

test/SILOptimizer/copy_propagation_borrow.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ bb0:
501501
%copy1 = copy_value %borrow1 : $C
502502
%borrow2 = begin_borrow %copy1 : $C
503503
%addr = ref_element_addr %borrow2 : $C, #C.a
504+
%ptr = address_to_pointer %addr : $*Int64 to $Builtin.RawPointer
504505
cond_br undef, bb1, bb2
505506
bb1:
506507
// inside use
@@ -1201,4 +1202,3 @@ bb0(%0 : @guaranteed $C):
12011202
%7 = tuple ()
12021203
return %7 : $()
12031204
}
1204-

test/SILOptimizer/liveness_unit.sil

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,13 @@ bb4(%phi : @owned $C):
222222
return %99 : $()
223223
}
224224

225-
// A dead (ref_element_addr) projection is treated like a pointer
226-
// escape for convenience. Make sure the pointer escape bubbles up
227-
// through the phi and casts.
228-
//
229225
// CHECK-LABEL: testSSADeadRefElementAddr: ssa-liveness
230226
// CHECK: SSA lifetime analysis: %0 = argument of bb0 : $C
231-
// CHECK-NEXT: Incomplete liveness: Escaping address
232227
// CHECK-NEXT: bb0: LiveOut
233228
// CHECK-NEXT: bb2: LiveOut
234229
// CHECK-NEXT: bb3: LiveWithin
235230
// CHECK-NEXT: bb1: LiveOut
236-
// CHECK: last user:
237-
// CHECK-SAME: ref_element_addr %6 : $D, #D.object
231+
// CHECK: ref_element_addr %6 : $D, #D.object
238232
// CHECK-NEXT-LABEL: end running test 1 of 1 on testSSADeadRefElementAddr: ssa-liveness
239233
sil [ossa] @testSSADeadRefElementAddr : $@convention(thin) (@guaranteed C) -> () {
240234
bb0(%0 : @guaranteed $C):

0 commit comments

Comments
 (0)