mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This reverts commit a182a7085d.
I also fixed the tests as well.
NOTE: In the generic case of debug_value_addr, the self parameter with asserts
seems to be a var and without asserts a let. This is apparent at the AST level
before we even get to anything that I have changed. This seems to suggest that
there is some sort of uninitialized memory or something like that. Regardless
that is more of an AST level thing, so I just put in a regex that match both
patterns and send rdar://89237318 over to Robert Widmann!
43 lines
1.4 KiB
Swift
43 lines
1.4 KiB
Swift
// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | %FileCheck %s
|
|
// RUN: %target-swift-frontend %s -emit-sil -g -o - | %FileCheck -check-prefix=CHECK-SIL %s
|
|
|
|
// Temporarily disable on arm64 (rdar://89237318)
|
|
// UNSUPPORTED: CPU=arm64
|
|
|
|
// Verify that -Onone shadow copies are emitted for debug_value_addr
|
|
// instructions.
|
|
|
|
// CHECK-SIL: sil hidden @$s16debug_value_addr4testyyxlF
|
|
// CHECK-SIL: debug_value %0 : $*T, let, name "t", {{.*}}, expr op_deref
|
|
|
|
// CHECK: define {{.*}}$s16debug_value_addr4testyyxlF
|
|
// CHECK: entry:
|
|
// CHECK-NEXT: %[[TADDR:.*]] = alloca
|
|
// CHECK-NEXT: call void @llvm.dbg.declare({{.*}}%[[TADDR]]
|
|
// CHECK: store %swift.opaque* %0, %swift.opaque** %[[TADDR:.*]], align
|
|
|
|
struct S<T> {
|
|
var a : T
|
|
func foo() {}
|
|
}
|
|
|
|
func test<T>(_ t : T) {
|
|
let a = S(a: t)
|
|
a.foo()
|
|
}
|
|
|
|
func use<T>(_ t : T) {}
|
|
|
|
// CHECK-SIL: sil hidden @$s16debug_value_addr11GenericSelfV1xACyxGx_tcfC : $@convention(method) <T> (@in T, @thin GenericSelf<T>.Type) -> GenericSelf<T> {
|
|
// CHECK-SIL: bb0(%0 : $*T, %1 : $@thin GenericSelf<T>.Type):
|
|
//
|
|
// CHECK-SIL-NEXT: alloc_stack [lexical] $GenericSelf<T>, {{var|let}}, name "self", implicit, loc {{.*}}
|
|
// CHECK-SIL-NEXT: debug_value %0 : $*T, let, name "x", argno 1, expr op_deref, loc {{.*}}
|
|
struct GenericSelf<T> {
|
|
init(x: T) {
|
|
// 'self' is a valid debug variable here even though there is
|
|
// nothing to initialize (the dead alloc_stack cannot be removed).
|
|
use(x)
|
|
}
|
|
}
|