Files
swift-mirror/test/SIL/Parser/debug_transform_block.sil
Emil Pedersen d0f338d269 SIL: Make constant debug_values have 0 operand
killOperand can remove the operand in place, keeping other existing
Operand pointers valid, as that is what passes expect.
2026-08-11 19:39:48 +01:00

48 lines
1.8 KiB
Plaintext

// RUN: %target-sil-opt -sil-print-types %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 (), 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 (), 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'