mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add a SIL test case for a dead alloc_stack with debug variable.
This commit is contained in:
@@ -22,3 +22,17 @@ 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, 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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user