Files
swift-mirror/test/DebugInfo/arg-debug_value.swift
Adrian Prantl 053d7cf277 Debug Info: Don't emit shadow stack copies for local variables.
The effect of this tiny change is that local variables will be described
by llvm.dbg.values, which will get lowered into an accurate location list
instead of a stack slot that is valid for the entire scope of the variable.
This means the debugger can now accurately track the liveness of variables
knowing exactly when they are initialized and when there values go away.
Function arguments are still kept in stack slots because (1) they are
already initialized at the function entry and (2) LLDB really needs self
to be available at all times for the expression evaluator.

This was made possible by recent advancements in LLVM such as the live
debug variables pass and various related bugfixes.

<rdar://problem/15746520>
2016-03-08 11:10:02 -08:00

15 lines
408 B
Swift

// RUN: %target-swift-frontend -primary-file %s -emit-ir -g -o - | FileCheck %s
// Verify that arguments described by debug_value intrinsics are only
// emitted once.
var g: Int64 = 1
class Foo {
var x: Int64
// CHECK: define {{.*}}_TFC4main3FoocfT_S0_
// CHECK: entry:
// CHECK-NEXT: call void @llvm.dbg.value(metadata %C4main3Foo* %0
// CHECK: ret %C4main3Foo* %0
init () { x = g; g += 1 }
}