Files
swift-mirror/test/DebugInfo/debug_value_addr.swift
Adrian Prantl 84d9238315 Emit llvm.dbg.declare intrisics immediately after the described alloca.
This cleanup change doesn't change the semantics, but it makes the
resulting IR much easier to read and debug.
2017-05-24 09:13:41 -07:00

25 lines
715 B
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
// Verify that -Onone shadow copies are emitted for debug_value_addr
// instructions.
// CHECK-SIL: sil hidden @_T016debug_value_addr4testyxlF
// CHECK-SIL: debug_value_addr %0 : $*T, let, name "t"
// CHECK: define {{.*}}_T016debug_value_addr4testyxlF
// 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()
}