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.
28 lines
973 B
Plaintext
28 lines
973 B
Plaintext
// RUN: %target-sil-opt -sil-print-types -enable-sil-verify-all %s -simplification -simplify-instruction=struct_extract -sil-print-debuginfo | %FileCheck %s
|
|
|
|
// REQUIRES: swift_in_compiler
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
struct T {
|
|
var x: Builtin.Int32
|
|
}
|
|
|
|
// This verifies that tryReplaceRedundantInstructionPair in OptUtils.swift
|
|
// salvages debug info attached to the first instruction of the pair,
|
|
// in this case the struct.
|
|
//
|
|
// CHECK-LABEL: sil @redundant_pair : $@convention(thin) (Builtin.Int32) -> Builtin.Int32 {
|
|
// CHECK: bb0([[VAR:%[0-9]+]] : $Builtin.Int32):
|
|
// CHECK-NEXT: debug_value [[VAR]] : $Builtin.Int32, let, name "var", type $T, expr op_fragment:#T.x
|
|
// CHECK-NEXT: return [[VAR]]
|
|
// CHECK-LABEL: } // end sil function 'redundant_pair'
|
|
sil @redundant_pair : $@convention(thin) (Builtin.Int32) -> Builtin.Int32 {
|
|
bb0(%0 : $Builtin.Int32):
|
|
%1 = struct $T(%0)
|
|
debug_value %1, let, name "var"
|
|
%2 = struct_extract %1, #T.x
|
|
return %2
|
|
}
|