Files
swift-mirror/test/SIL/Parser/debug_transform_block.sil
T
Emil Pedersen b6f15a9ea0 [DebugInfo] Add verification of debug basic blocks
Add type-chain checks and other SIL verifier checks for debug_value
transform blocks.

Assisted-by: Claude
2026-05-13 16:03:52 +01:00

48 lines
1.8 KiB
Plaintext

// RUN: %target-sil-opt -sil-print-types -verify-debug-value-expr %s | %FileCheck %s
sil_stage canonical
import Builtin
import Swift
sil_scope 1 { parent @test_transform_const : $@convention(thin) () -> () }
// CHECK-LABEL: sil @test_transform_const :
sil @test_transform_const : $@convention(thin) () -> () {
bb0:
// CHECK: debug_value undef : $Builtin.Int64, let, name "x", type $Int64, expr op_fragment:#Int64._value, transform {
// CHECK: bb0:
// CHECK: %0 = integer_literal $Builtin.Int64, 42
// CHECK: return %0 : $Builtin.Int64
// CHECK: }
debug_value undef : $Builtin.Int64, let, name "x", type $Int64, expr op_fragment:#Int64._value, transform {
bb0:
%0 = integer_literal $Builtin.Int64, 42
return %0 : $Builtin.Int64
}
%r = tuple ()
return %r : $()
}
// CHECK: } // end sil function 'test_transform_const'
sil_scope 2 { parent @test_transform_with_arg : $@convention(thin) (Builtin.Int64) -> () }
// CHECK-LABEL: sil @test_transform_with_arg :
sil @test_transform_with_arg : $@convention(thin) (Builtin.Int64) -> () {
bb0(%arg : $Builtin.Int64):
// CHECK: debug_value %0 : $Builtin.Int64, let, name "y", type $Int64, expr op_fragment:#Int64._value, transform {
// CHECK: bb0(%0 : $Builtin.Int64):
// CHECK: %1 = integer_literal $Builtin.Int64, 10
// CHECK: %2 = builtin "add_Int64"(%0 : $Builtin.Int64, %1 : $Builtin.Int64) : $Builtin.Int64
// CHECK: return %2 : $Builtin.Int64
// CHECK: }
debug_value %arg : $Builtin.Int64, let, name "y", type $Int64, expr op_fragment:#Int64._value, transform {
bb0(%0 : $Builtin.Int64):
%1 = integer_literal $Builtin.Int64, 10
%2 = builtin "add_Int64"(%0 : $Builtin.Int64, %1 : $Builtin.Int64) : $Builtin.Int64
return %2 : $Builtin.Int64
}
%r = tuple ()
return %r : $()
}
// CHECK: } // end sil function 'test_transform_with_arg'