mirror of
https://github.com/apple/swift.git
synced 2026-02-27 18:26:24 +01:00
This reverts commit b1eb70bf45.
The original PR (#85244) was reverted (#85836) due to rdar://165667449
This version fixes the aforementioned issue, and (potentially) improves overall
debug info retention by salvaging info in erase(instructionIncludingDebugUses:),
rather than inserting many explicit salvageDebugInfo calls throughout the code
to make the test cases pass.
Bridging: Make salvageDebugInfo a method of MutatingContext
This feels more consistent than making it a method of Instruction.
DebugInfo: Salvage from trivially dead instructions
This handles the case we were checking in constantFoldBuiltin, so we do not need to salvage debug info there any more.
27 lines
1.0 KiB
Plaintext
27 lines
1.0 KiB
Plaintext
// RUN: %target-sil-opt -sil-print-types -sil-verify-all -temp-lvalue-elimination %s | %FileCheck %s
|
|
sil_stage canonical
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
|
|
import Builtin
|
|
|
|
// This verifies that the TempLValueElimination pass correctly salvages the
|
|
// debug variable attribute of alloc_stack instructions.
|
|
//
|
|
// CHECK-LABEL: sil @stack_var_elimination : $@convention(thin) (Builtin.Int32) -> @out Builtin.Int32 {
|
|
// CHECK: bb0([[X:%[0-9]+]] : $*Builtin.Int32, [[VAL:%[0-9]+]] : $Builtin.Int32):
|
|
// CHECK-NEXT: debug_value [[X]] : $*Builtin.Int32, var, name "x"
|
|
// CHECK-NEXT: store [[VAL]] to [[X]] : $*Builtin.Int32
|
|
// CHECK-NEXT: [[E:%[0-9]+]] = tuple ()
|
|
// CHECK-NEXT: return [[E]] : $()
|
|
// CHECK-LABEL: } // end sil function 'stack_var_elimination'
|
|
sil @stack_var_elimination : $@convention(thin) (Builtin.Int32) -> @out Builtin.Int32 {
|
|
bb0(%0 : $*Builtin.Int32, %1 : $Builtin.Int32):
|
|
%2 = alloc_stack [var_decl] $Builtin.Int32, var, name "x"
|
|
store %1 to %2
|
|
copy_addr %2 to %0
|
|
dealloc_stack %2
|
|
%3 = tuple ()
|
|
return %3
|
|
}
|