Skip to content

Commit 88c2905

Browse files
committed
WalkUtils: handle mark_dependence instruction in the ValueUseDefWalker
It was already handled in the ValueDefUseWalker
1 parent c85153a commit 88c2905

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

SwiftCompilerSources/Sources/SIL/Utilities/WalkUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ extension ValueUseDefWalker {
689689
return walkUp(value: oer.existential, path: path.push(.existential, index: 0))
690690
case is BeginBorrowInst, is CopyValueInst, is MoveValueInst,
691691
is UpcastInst, is EndCOWMutationInst, is EndInitLetRefInst,
692-
is BeginDeallocRefInst,
692+
is BeginDeallocRefInst, is MarkDependenceInst,
693693
is RefToBridgeObjectInst, is BridgeObjectToRefInst, is MarkUnresolvedNonCopyableValueInst:
694694
return walkUp(value: (def as! Instruction).operands[0].value, path: path)
695695
case let urc as UncheckedRefCastInst:

test/SILOptimizer/accessutils.sil

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,3 +688,22 @@ bb0(%0 : $C, %1 : $Builtin.Word, %2 : $Builtin.Word):
688688
%200 = tuple ()
689689
return %200 : $()
690690
}
691+
692+
// CHECK-LABEL: Accesses for mark_dependence
693+
// CHECK: Value: %4 = pointer_to_address %3 : $Builtin.RawPointer to [strict] $*Int64 // user: %5
694+
// CHECK-NEXT: Scope: base
695+
// CHECK-NEXT: Base: class - %1 = ref_element_addr %0 : $List, #List.x
696+
// CHECK-NEXT: Path: ""
697+
// CHECK-NEXT: Storage: %0 = argument of bb0 : $List
698+
// CHECK-NEXT: Path: "c0"
699+
// CHECK-LABEL: End accesses for mark_dependence
700+
sil [ossa] @mark_dependence : $@convention(thin) (@guaranteed List) -> Int64 {
701+
bb0(%0 : @guaranteed $List):
702+
%1 = ref_element_addr %0, #List.x
703+
%2 = address_to_pointer %1 to $Builtin.RawPointer
704+
%3 = mark_dependence %2 on %0
705+
%4 = pointer_to_address %3 to [strict] $*Int64
706+
%6 = load [trivial] %4 : $*Int64
707+
return %6 : $Int64
708+
}
709+

0 commit comments

Comments
 (0)