Skip to content

Commit 8523e93

Browse files
Use DIExpression:foldConstantMath() at the result of an appendOpsToArg()
1 parent 749d8bd commit 8523e93

File tree

10 files changed

+75
-56
lines changed

10 files changed

+75
-56
lines changed

llvm/lib/IR/DebugInfoMetadata.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,8 @@ DIExpression *DIExpression::appendOpsToArg(const DIExpression *Expr,
17741774
assert(ArgNo == 0 &&
17751775
"Location Index must be 0 for a non-variadic expression.");
17761776
SmallVector<uint64_t, 8> NewOps(Ops.begin(), Ops.end());
1777-
return DIExpression::prependOpcodes(Expr, NewOps, StackValue);
1777+
return DIExpression::prependOpcodes(Expr, NewOps, StackValue)
1778+
->foldConstantMath();
17781779
}
17791780

17801781
SmallVector<uint64_t, 8> NewOps;
@@ -1795,7 +1796,7 @@ DIExpression *DIExpression::appendOpsToArg(const DIExpression *Expr,
17951796
if (StackValue)
17961797
NewOps.push_back(dwarf::DW_OP_stack_value);
17971798

1798-
return DIExpression::get(Expr->getContext(), NewOps);
1799+
return DIExpression::get(Expr->getContext(), NewOps)->foldConstantMath();
17991800
}
18001801

18011802
DIExpression *DIExpression::replaceArg(const DIExpression *Expr,

llvm/test/DebugInfo/MIR/InstrRef/deref-spills-with-size.mir

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@
8383
# DWARF-NEXT: DW_OP_breg7 RSP-8
8484
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_stack_value
8585
## scalar / stack value with various sizes.
86-
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value
87-
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value
88-
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value)
86+
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_plus_uconst 0x1, DW_OP_stack_value
87+
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref, DW_OP_plus_uconst 0x1, DW_OP_stack_value
88+
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_plus_uconst 0x1, DW_OP_stack_value)
8989
# DWARF: DW_AT_name ("flannel")
9090

9191
# Variable with fragments.
@@ -96,9 +96,9 @@
9696
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_piece 0x4
9797
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_stack_value, DW_OP_piece 0x4
9898
## Scalar / stack value with various sizes.
99-
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value, DW_OP_piece 0x4
100-
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x4, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value, DW_OP_piece 0x4
101-
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_lit1, DW_OP_plus, DW_OP_stack_value, DW_OP_piece 0x4)
99+
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x8, DW_OP_plus_uconst 0x1, DW_OP_stack_value, DW_OP_piece 0x4
100+
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x4, DW_OP_plus_uconst 0x1, DW_OP_stack_value, DW_OP_piece 0x4
101+
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref_size 0x1, DW_OP_plus_uconst 0x1, DW_OP_stack_value, DW_OP_piece 0x4)
102102
# DWARF: DW_AT_name ("shoes")
103103

104104
--- |
@@ -308,7 +308,7 @@ body: |
308308
$rax = MOV64ri 0, debug-location !7
309309
DBG_INSTR_REF !8, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value), dbg-instr-ref(16, 0), debug-location !7
310310
; CHECK: DBG_VALUE_LIST ![[VARNUM]],
311-
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 8, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value), $rsp
311+
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 8, DW_OP_plus_uconst, 1, DW_OP_stack_value), $rsp
312312
$eax = MOV32ri 0, debug-location !7
313313
DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
314314
; CHECK: DBG_VALUE $noreg, $noreg
@@ -319,7 +319,7 @@ body: |
319319
$rax = MOV64ri 0, debug-location !7
320320
DBG_INSTR_REF !8, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value), dbg-instr-ref(17, 0), debug-location !7
321321
; CHECK: DBG_VALUE_LIST ![[VARNUM]],
322-
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value), $rsp
322+
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_plus_uconst, 1, DW_OP_stack_value), $rsp
323323
$eax = MOV32ri 0, debug-location !7
324324
DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
325325
; CHECK: DBG_VALUE $noreg, $noreg
@@ -330,7 +330,7 @@ body: |
330330
$rax = MOV64ri 0, debug-location !7
331331
DBG_INSTR_REF !8, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value), dbg-instr-ref(18, 0), debug-location !7
332332
; CHECK: DBG_VALUE_LIST ![[VARNUM]],
333-
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 1, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value), $rsp
333+
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 1, DW_OP_plus_uconst, 1, DW_OP_stack_value), $rsp
334334
$eax = MOV32ri 0, debug-location !7
335335
DBG_VALUE $noreg, $noreg, !8, !DIExpression(), debug-location !7
336336
; CHECK: DBG_VALUE $noreg, $noreg
@@ -341,7 +341,7 @@ body: |
341341
$rax = MOV64ri 0, debug-location !7
342342
DBG_INSTR_REF !10, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), dbg-instr-ref(19, 0), debug-location !7
343343
; CHECK: DBG_VALUE_LIST ![[VARNUM2]],
344-
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 8, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), $rsp
344+
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 8, DW_OP_plus_uconst, 1, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), $rsp
345345
$eax = MOV32ri 0, debug-location !7
346346
DBG_VALUE $noreg, $noreg, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
347347
; CHECK: DBG_VALUE $noreg, $noreg
@@ -352,7 +352,7 @@ body: |
352352
$rax = MOV64ri 0, debug-location !7
353353
DBG_INSTR_REF !10, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), dbg-instr-ref(20, 0), debug-location !7
354354
; CHECK: DBG_VALUE_LIST ![[VARNUM2]],
355-
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 4, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), $rsp
355+
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 4, DW_OP_plus_uconst, 1, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), $rsp
356356
$eax = MOV32ri 0, debug-location !7
357357
DBG_VALUE $noreg, $noreg, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
358358
; CHECK: DBG_VALUE $noreg, $noreg
@@ -363,7 +363,7 @@ body: |
363363
$rax = MOV64ri 0, debug-location !7
364364
DBG_INSTR_REF !10, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), dbg-instr-ref(21, 0), debug-location !7
365365
; CHECK: DBG_VALUE_LIST ![[VARNUM2]],
366-
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 1, DW_OP_constu, 1, DW_OP_plus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), $rsp
366+
; CHECK-SAME: !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 8, DW_OP_minus, DW_OP_deref_size, 1, DW_OP_plus_uconst, 1, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32), $rsp
367367
$eax = MOV32ri 0, debug-location !7
368368
DBG_VALUE $noreg, $noreg, !10, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !7
369369
; CHECK: DBG_VALUE $noreg, $noreg

llvm/test/DebugInfo/MIR/InstrRef/follow-spill-of-indir-value.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
##
2828
## Second location, variable pointed to by the register value plus eight.
2929
##
30-
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref, DW_OP_lit8, DW_OP_plus)
30+
# DWARF-NEXT: DW_OP_breg7 RSP-8, DW_OP_deref, DW_OP_plus_uconst 0x8)
3131
##
3232
## Spilt to stack: push stack location and deref the pointer onto the dwarf
3333
## expr stack. Then add eight to it, and it points to the variable.
@@ -135,7 +135,7 @@ body: |
135135
; CHECK: DBG_VALUE $rdi,
136136
MOV64mr $rsp, 1, $noreg, -8, $noreg, $rdi :: (store (s64) into %stack.0)
137137
$rdi = MOV64ri 0
138-
; CHECK: DBG_VALUE $rsp, 0, ![[VARNUM]], !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_constu, 8, DW_OP_plus),
138+
; CHECK: DBG_VALUE $rsp, 0, ![[VARNUM]], !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_deref, DW_OP_plus_uconst, 8),
139139
140140
renamable $rax = MOV64rm $rsp, 1, $noreg, -8, $noreg :: (load (s64) from %stack.0)
141141
renamable $eax = MOV32rm killed renamable $rax, 1, $noreg, 0, $noreg, debug-location !24 :: (load (s32) from %ir.i1, !tbaa !25)

llvm/test/DebugInfo/salvage-icmp.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
; CHECK: call void @llvm.dbg.value(metadata i32 %a,
77
; CHECK-SAME: ![[VAR_C:[0-9]+]],
8-
; CHECK-SAME: !DIExpression(DW_OP_constu, 0, DW_OP_ne, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_constu, 0, DW_OP_eq, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_constu, 1, DW_OP_gt, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_consts, 18446744073709551615, DW_OP_gt, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_constu, 2, DW_OP_ge, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_consts, 18446744073709551614, DW_OP_ge, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_constu, 3, DW_OP_lt, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_consts, 18446744073709551613, DW_OP_lt, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_constu, 4, DW_OP_le, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_consts, 18446744073709551612, DW_OP_le, DW_OP_stack_value))
8+
; CHECK-SAME: !DIExpression(DW_OP_lit0, DW_OP_ne, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_lit0, DW_OP_eq, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_constu, 1, DW_OP_gt, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_consts, 18446744073709551615, DW_OP_gt, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_constu, 2, DW_OP_ge, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_consts, 18446744073709551614, DW_OP_ge, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_constu, 3, DW_OP_lt, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_consts, 18446744073709551613, DW_OP_lt, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_constu, 4, DW_OP_le, DW_OP_LLVM_convert, 1, DW_ATE_unsigned, DW_OP_LLVM_convert, 32, DW_ATE_unsigned, DW_OP_consts, 18446744073709551612, DW_OP_le, DW_OP_stack_value))
99

1010
; CHECK: call void @llvm.dbg.value(metadata !DIArgList(i32 %a, i32 %a, i32 %a, i32 %b, i32 %a, i32 %b, i32 %b, i32 %a, i32 %a, i32 %b, i32 %b),
1111
; CHECK-SAME: ![[VAR_C:[0-9]+]],

llvm/test/Transforms/Coroutines/swift-async-dbg.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ define swifttailcc void @coroutineA(ptr swiftasync %arg) !dbg !48 {
3030
; CHECK-LABEL: define {{.*}} @coroutineA(
3131
; CHECK-SAME: ptr swiftasync %[[frame_ptr:.*]])
3232
; CHECK: @llvm.dbg.declare(metadata ptr %[[frame_ptr]], {{.*}} !DIExpression(
33-
; CHECK-SAME: DW_OP_plus_uconst, 16, DW_OP_plus_uconst, 8)
33+
; CHECK-SAME: DW_OP_plus_uconst, 24)
3434
; CHECK: @llvm.dbg.value(metadata ptr %[[frame_ptr]], {{.*}} !DIExpression(
3535
; CHECK-SAME: DW_OP_plus_uconst, 16, DW_OP_deref)
3636
; CHECK: call {{.*}} @swift_task_switch
@@ -49,7 +49,7 @@ define swifttailcc void @coroutineA(ptr swiftasync %arg) !dbg !48 {
4949
; CHECK-LABEL: define {{.*}} @coroutineATY0_(
5050
; CHECK-SAME: ptr swiftasync %[[frame_ptr:.*]])
5151
; CHECK: @llvm.dbg.declare(metadata ptr %[[frame_ptr]], {{.*}} !DIExpression(
52-
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 16, DW_OP_plus_uconst, 8)
52+
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 24)
5353
; CHECK: @llvm.dbg.value(metadata ptr %[[frame_ptr]], {{.*}} !DIExpression(
5454
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 16, DW_OP_deref)
5555
; CHECK: @llvm.dbg.value(metadata !DIArgList(ptr %[[frame_ptr]], i32 %{{.*}}), {{.*}} !DIExpression(
@@ -70,7 +70,7 @@ define swifttailcc void @coroutineA(ptr swiftasync %arg) !dbg !48 {
7070
; CHECK-SAME: ptr swiftasync %[[frame_ptr:.*]])
7171
; Note the extra level of indirection that shows up here!
7272
; CHECK: @llvm.dbg.declare(metadata ptr %[[frame_ptr]], {{.*}} !DIExpression(
73-
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_deref, DW_OP_plus_uconst, 16, DW_OP_plus_uconst, 8)
73+
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_deref, DW_OP_plus_uconst, 24)
7474
; CHECK: @llvm.dbg.value(metadata ptr %[[frame_ptr]], {{.*}} !DIExpression(
7575
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_deref, DW_OP_plus_uconst, 16, DW_OP_deref)
7676
; CHECK: call {{.*}} @swift_task_switch
@@ -85,7 +85,7 @@ define swifttailcc void @coroutineA(ptr swiftasync %arg) !dbg !48 {
8585
; CHECK-LABEL: define {{.*}} @coroutineATY2_(
8686
; CHECK-SAME: ptr swiftasync %[[frame_ptr:.*]])
8787
; CHECK: @llvm.dbg.declare(metadata ptr %[[frame_ptr]], {{.*}} !DIExpression(
88-
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 16, DW_OP_plus_uconst, 8)
88+
; CHECK-SAME: DW_OP_LLVM_entry_value, 1, DW_OP_plus_uconst, 24)
8989
}
9090

9191
; Everything from here on is just support code for the coroutines.

llvm/test/Transforms/InstCombine/cast-mul-select.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ define void @PR36225(i32 %a, i32 %b, i1 %c1, i3 %v1, i3 %v2) {
207207
; DBGINFO-NEXT: entry:
208208
; DBGINFO-NEXT: br label [[WHILE_BODY:%.*]], !dbg [[DBG94:![0-9]+]]
209209
; DBGINFO: while.body:
210-
; DBGINFO-NEXT: call void @llvm.dbg.value(metadata i32 [[B:%.*]], metadata [[META89:![0-9]+]], metadata !DIExpression(DW_OP_constu, 0, DW_OP_eq, DW_OP_stack_value)), !dbg [[DBG95:![0-9]+]]
210+
; DBGINFO-NEXT: call void @llvm.dbg.value(metadata i32 [[B:%.*]], metadata [[META89:![0-9]+]], metadata !DIExpression(DW_OP_lit0, DW_OP_eq, DW_OP_stack_value)), !dbg [[DBG95:![0-9]+]]
211211
; DBGINFO-NEXT: br i1 [[C1:%.*]], label [[FOR_BODY3_US:%.*]], label [[FOR_BODY3:%.*]], !dbg [[DBG96:![0-9]+]]
212212
; DBGINFO: for.body3.us:
213213
; DBGINFO-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[B]], 0, !dbg [[DBG95]]

llvm/test/Transforms/InstCombine/debuginfo-dce.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ entry:
6161
; CHECK: define void @salvage_gep0
6262
; CHECK-NEXT: entry:
6363
; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr %queue,
64-
; CHECK-SAME: metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 0, DW_OP_stack_value))
64+
; CHECK-SAME: metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_stack_value))
6565
store ptr %1, ptr %im_not_dead, align 8
6666
ret void, !dbg !26
6767
}

llvm/test/Transforms/InstCombine/debuginfo-sink.ll

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -54,33 +54,33 @@ sink2:
5454
ret i32 %extract
5555
}
5656

57-
; This GEP is sunk, and has multiple debug uses in the same block. Check that
58-
; only the last use is cloned into the sunk block, and that both of the
59-
; original dbg.values are salvaged.
60-
;
61-
; CHECK-LABEL: define i32 @baz(ptr
62-
; CHECK: call void @llvm.dbg.value(metadata ptr %a, metadata !{{[0-9]+}},
63-
; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value))
64-
; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr %a, metadata !{{[0-9]+}},
65-
; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 4, DW_OP_plus_uconst, 5, DW_OP_stack_value))
66-
; CHECK-NEXT: br label %sink1
67-
68-
define i32 @baz(ptr %a) !dbg !80 {
69-
entry:
70-
%gep = getelementptr i32, ptr %a, i32 1
71-
call void @llvm.dbg.value(metadata ptr %gep, metadata !83, metadata !12), !dbg !84
72-
call void @llvm.dbg.value(metadata ptr %gep, metadata !83, metadata !DIExpression(DW_OP_plus_uconst, 5)), !dbg !85
73-
br label %sink1
74-
75-
sink1:
76-
; CHECK-LABEL: sink1:
77-
; CHECK: call void @llvm.dbg.value(metadata ptr %gep,
78-
; CHECK-SAME: metadata !{{[0-9]+}}, metadata !DIExpression(DW_OP_plus_uconst, 5))
79-
; CHECK-NEXT: load
80-
%0 = load i32, ptr %gep, align 4, !dbg !85
81-
ret i32 %0, !dbg !85
82-
}
83-
57+
; This GEP is sunk, and has multiple debug uses in the same block. Check that
58+
; only the last use is cloned into the sunk block, and that both of the
59+
; original dbg.values are salvaged.
60+
;
61+
; CHECK-LABEL: define i32 @baz(ptr
62+
; CHECK: call void @llvm.dbg.value(metadata ptr %a, metadata !{{[0-9]+}},
63+
; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 4, DW_OP_stack_value))
64+
; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr %a, metadata !{{[0-9]+}},
65+
; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 9, DW_OP_stack_value))
66+
; CHECK-NEXT: br label %sink1
67+
68+
define i32 @baz(ptr %a) !dbg !80 {
69+
entry:
70+
%gep = getelementptr i32, ptr %a, i32 1
71+
call void @llvm.dbg.value(metadata ptr %gep, metadata !83, metadata !12), !dbg !84
72+
call void @llvm.dbg.value(metadata ptr %gep, metadata !83, metadata !DIExpression(DW_OP_plus_uconst, 5)), !dbg !85
73+
br label %sink1
74+
75+
sink1:
76+
; CHECK-LABEL: sink1:
77+
; CHECK: call void @llvm.dbg.value(metadata ptr %gep,
78+
; CHECK-SAME: metadata !{{[0-9]+}}, metadata !DIExpression(DW_OP_plus_uconst, 5))
79+
; CHECK-NEXT: load
80+
%0 = load i32, ptr %gep, align 4, !dbg !85
81+
ret i32 %0, !dbg !85
82+
}
83+
8484
!llvm.dbg.cu = !{!0}
8585
!llvm.module.flags = !{!3, !4, !5}
8686
!llvm.ident = !{!6}
@@ -105,7 +105,7 @@ sink1:
105105
!72 = !{!10, !10, !10}
106106
!73 = !DILocalVariable(name: "k", scope: !70, file: !1, line: 2, type: !10)
107107
!74 = !DILocation(line: 5, column: 3, scope: !70)
108-
!80 = distinct !DISubprogram(name: "baz", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
109-
!83 = !DILocalVariable(name: "l", scope: !80, file: !1, line: 2, type: !10)
110-
!84 = !DILocation(line: 5, column: 3, scope: !80)
111-
!85 = !DILocation(line: 6, column: 3, scope: !80)
108+
!80 = distinct !DISubprogram(name: "baz", scope: !1, file: !1, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
109+
!83 = !DILocalVariable(name: "l", scope: !80, file: !1, line: 2, type: !10)
110+
!84 = !DILocation(line: 5, column: 3, scope: !80)
111+
!85 = !DILocation(line: 6, column: 3, scope: !80)

0 commit comments

Comments
 (0)