@@ -12,4 +12,20 @@ debug_value undef : $Builtin.Int64, var, name "optimizedout"
1212return %0 : $Builtin.Int64
1313}
1414
15+ // CHECK-LABEL: define {{.*}} @arithmetic
16+ sil @arithmetic : $@convention(thin) (Builtin.Int64) -> (Builtin.Int64) {
17+ bb0(%0 : $Builtin.Int64):
18+ // CHECK: call void @llvm.dbg.value(metadata i64 %0, metadata ![[CURRENT_VAR:[0-9]+]], metadata !DIExpression())
19+ debug_value %0 : $Builtin.Int64, var, name "current", type $Int, expr op_fragment:#Int._value
20+ // FIXME: It should work with the fragment, as it should be noop.
21+ // CHECK: call void @llvm.dbg.value(metadata i64 %0, metadata ![[PREVIOUS_VAR:[0-9]+]], metadata !DIExpression(DW_OP_consts, 1, DW_OP_minus, DW_OP_stack_value))
22+ debug_value %0 : $Builtin.Int64, var, name "previous", type $Int, expr op_consts:1:op_minus //:op_fragment:#Int._value
23+ // CHECK: call void @llvm.dbg.value(metadata i64 %0, metadata ![[NEXT_VAR:[0-9]+]], metadata !DIExpression(DW_OP_constu, 12, DW_OP_plus, DW_OP_stack_value))
24+ debug_value %0 : $Builtin.Int64, var, name "next", type $Int, expr op_constu:12:op_plus //:op_fragment:#Int._value
25+ return %0 : $Builtin.Int64
26+ }
27+
1528// CHECK: ![[JUST_UNDEF_VAR]] = !DILocalVariable(name: "optimizedout"
29+ // CHECK: ![[CURRENT_VAR]] = !DILocalVariable(name: "current"
30+ // CHECK: ![[PREVIOUS_VAR]] = !DILocalVariable(name: "previous"
31+ // CHECK: ![[NEXT_VAR]] = !DILocalVariable(name: "next"
0 commit comments