1 ; RUN: llc %s -o - -stop-after=finalize-isel \
2 ; RUN: | FileCheck %s --implicit-check-not=DBG
3 ; RUN: llc --try-experimental-debuginfo-iterators %s -o - -stop-after=finalize-isel \
4 ; RUN: | FileCheck %s --implicit-check-not=DBG
6 ;; In the IR below, for variable n, we get dbg intrinsics that describe this:
9 ;; Frag (off=0, sz=32): non-undef
10 ;; Frag (off=64, sz=64): undef
11 ;; Frag (off=64, sz=32): non-undef
13 ;; The undef is redundant, as it doesn't close any open location ranges. Check
14 ;; that it has been removed. Removing redundant undefs from the entry block
15 ;; helps avoid losing coverage due to SelectionDAG doing weird (/bad) things.
16 ;; Even if SelectionDAG is fixed, fewer redundant DBG instructions is still a
21 ;; We expect to see two DBG instructions, one for each non-undef fragment. We
22 ;; don't bother checking the operands because it doesn't matter if either of
23 ;; these have become undef as a result of SelectionDAG dropping the values
24 ;; (which happens to be the case here). It's just important that SelectionDAG
25 ;; was fed these fragments.
27 ; CHECK: DBG{{.*}}DIExpression({{(DW_OP_LLVM_arg, 0, )?}}DW_OP_LLVM_fragment, 0, 32)
28 ; CHECK: DBG{{.*}}DIExpression({{(DW_OP_LLVM_arg, 0, )?}}DW_OP_LLVM_fragment, 64, 32)
32 ;; IR llvm-reduced from optimized IR generated from, itself reduced from
33 ;; CTMark's bullet source file btScaledBvhTriangleMeshShape.cpp:
37 ;; __attribute__((nodebug)) a() {}
38 ;; __attribute__((nodebug)) a(float c, float p2) {
42 ;; __attribute__((nodebug)) void operator+=(a) {
46 ;; __attribute__((nodebug)) float d(a c) { return c.b[0] + c.b[2]; }
49 ;; __attribute__((nodebug)) void operator-(a, a);
50 ;; __attribute__((nodebug)) a operator*(float, a p2) {
51 ;; a e(p2.b[0], p2.b[2]);
55 ;; __attribute__((nodebug)) a x();
56 ;; __attribute__((nodebug)) a y(int);
59 ;; __attribute__((nodebug)) a l = x();
60 ;; __attribute__((nodebug)) a m = l;
61 ;; __attribute__((nodebug)) a ag;
65 ;; __attribute__((nodebug)) a ah(y(0).d(n), 0);
68 target triple = "x86_64-unknown-linux-gnu"
70 define void @_Z1kv({ <2 x float>, <2 x float> } %call, <2 x float> %0, float %n.sroa.6.8.vec.extract) !dbg !7 {
72 %call1 = tail call { <2 x float>, <2 x float> } poison(), !dbg !13
73 %1 = extractvalue { <2 x float>, <2 x float> } %call, 1
74 %add.i = fadd float poison, 0.000000e+00
75 call void @llvm.dbg.assign(metadata float %add.i, metadata !11, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32), metadata !14, metadata ptr undef, metadata !DIExpression()), !dbg !15
76 %n.sroa.6.8.vec.extract2 = extractelement <2 x float> %0, i64 0
77 %add4.i = fadd float %n.sroa.6.8.vec.extract, 0.000000e+00
78 call void @llvm.dbg.value(metadata <2 x float> undef, metadata !11, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !15
79 call void @llvm.dbg.assign(metadata float %add4.i, metadata !11, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 32), metadata !16, metadata ptr undef, metadata !DIExpression()), !dbg !15
80 %add.i23 = fadd float 0.000000e+00, 0.000000e+00
81 %ah.sroa.0.0.vec.insert = insertelement <2 x float> zeroinitializer, float %add4.i, i64 0
82 tail call void poison(<2 x float> zeroinitializer, <2 x float> zeroinitializer, <2 x float> %ah.sroa.0.0.vec.insert, <2 x float> zeroinitializer)
86 declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)
87 declare void @llvm.dbg.value(metadata, metadata, metadata)
90 !llvm.module.flags = !{!2, !3, !4, !5, !6, !1000}
92 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 14.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
93 !1 = !DIFile(filename: "reduce.cpp", directory: "/")
94 !2 = !{i32 7, !"Dwarf Version", i32 5}
95 !3 = !{i32 2, !"Debug Info Version", i32 3}
96 !4 = !{i32 1, !"wchar_size", i32 4}
97 !5 = !{i32 7, !"uwtable", i32 1}
98 !6 = !{i32 7, !"frame-pointer", i32 2}
99 !7 = distinct !DISubprogram(name: "k", linkageName: "_Z1kv", scope: !1, file: !1, line: 25, type: !8, scopeLine: 25, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
100 !8 = !DISubroutineType(types: !9)
103 !11 = !DILocalVariable(name: "n", scope: !7, file: !1, line: 29, type: !12)
104 !12 = !DICompositeType(tag: DW_TAG_class_type, name: "a", file: !1, line: 1, size: 128, flags: DIFlagFwdDecl | DIFlagNonTrivial, identifier: "_ZTS1a")
105 !13 = !DILocation(line: 26, scope: !7)
106 !14 = distinct !DIAssignID()
107 !15 = !DILocation(line: 0, scope: !7)
108 !16 = distinct !DIAssignID()
109 !1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}