Files
swift-mirror/test/DebugInfo/allocstack.swift
Nate Chandler a54a8ddaa3 [SIL] Key consume addr checking off var_decl attr.
Previously, the lexical attribute on allock_stack instructions was used.
This doesn't work for values without lexical lifetimes which are
consumed, e.g. stdlib CoW types.  Here, the new var_decl attribute on
alloc_stack is keyed off of instead.  This flag encodes exactly that a
value corresponds to a source-level VarDecl, which is the condition
under which checking needs to run.
2024-03-09 05:29:01 -08:00

20 lines
770 B
Swift

// RUN: %target-swift-frontend -enable-copy-propagation=requested-passes-only -enable-lexical-lifetimes=false %s -emit-ir -g -o - | %FileCheck %s
// RUN: %target-swift-frontend -enable-copy-propagation=requested-passes-only -enable-lexical-lifetimes=false %s -emit-sil -g -o - | %FileCheck -check-prefix=CHECK-SIL %s
import StdlibUnittest
// Test that debug info for local variables is preserved by the
// mandatory SIL optimization passes.
func main() {
// CHECK-SIL-DAG: debug_value {{.*}}: $Int, let, name "x"
// CHECK-DAG: DILocalVariable(name: "x"
let x = 10
// CHECK-SIL-DAG: alloc_stack [var_decl] $Int, var, name "y"
// CHECK-DAG: DILocalVariable(name: "y"
var y = 10
// The expression x+y may become constant folded.
_blackHole(x+y)
}
main()