108 lines · plain
1; RUN: llc %s -o - -stop-after=finalize-isel \2; RUN: | FileCheck %s --implicit-check-not=DBG3 4;; In the IR below, for variable n, we get dbg intrinsics that describe this:5;;6;; entry-block:7;; Frag (off=0, sz=32): non-undef8;; Frag (off=64, sz=64): undef9;; Frag (off=64, sz=32): non-undef10;;11;; The undef is redundant, as it doesn't close any open location ranges. Check12;; that it has been removed. Removing redundant undefs from the entry block13;; helps avoid losing coverage due to SelectionDAG doing weird (/bad) things.14;; Even if SelectionDAG is fixed, fewer redundant DBG instructions is still a15;; valuable goal.16 17;; The test18;; --------19;; We expect to see two DBG instructions, one for each non-undef fragment. We20;; don't bother checking the operands because it doesn't matter if either of21;; these have become undef as a result of SelectionDAG dropping the values22;; (which happens to be the case here). It's just important that SelectionDAG23;; was fed these fragments.24 25; CHECK: DBG{{.*}}DIExpression({{(DW_OP_LLVM_arg, 0, )?}}DW_OP_LLVM_fragment, 0, 32)26; CHECK: DBG{{.*}}DIExpression({{(DW_OP_LLVM_arg, 0, )?}}DW_OP_LLVM_fragment, 64, 32)27 28;; Source29;; ------30;; IR llvm-reduced from optimized IR generated from, itself reduced from31;; CTMark's bullet source file btScaledBvhTriangleMeshShape.cpp:32;; class a {33;; public:34;; float b[4];35;; __attribute__((nodebug)) a() {}36;; __attribute__((nodebug)) a(float c, float p2) {37;; b[0] = c;38;; b[2] = p2;39;; }40;; __attribute__((nodebug)) void operator+=(a) {41;; b[0] += 0;42;; b[2] += 2;43;; }44;; __attribute__((nodebug)) float d(a c) { return c.b[0] + c.b[2]; }45;; };46;;47;; __attribute__((nodebug)) void operator-(a, a);48;; __attribute__((nodebug)) a operator*(float, a p2) {49;; a e(p2.b[0], p2.b[2]);50;; return e;51;; }52;;53;; __attribute__((nodebug)) a x();54;; __attribute__((nodebug)) a y(int);55;;56;; void k() {57;; __attribute__((nodebug)) a l = x();58;; __attribute__((nodebug)) a m = l;59;; __attribute__((nodebug)) a ag;60;; a n = 0.f * m;61;;62;; n += a();63;; __attribute__((nodebug)) a ah(y(0).d(n), 0);64;; ag - ah;65;; }66target triple = "x86_64-unknown-linux-gnu"67 68define void @_Z1kv({ <2 x float>, <2 x float> } %call, <2 x float> %0, float %n.sroa.6.8.vec.extract) !dbg !7 {69entry:70 %call1 = tail call { <2 x float>, <2 x float> } poison(), !dbg !1371 %1 = extractvalue { <2 x float>, <2 x float> } %call, 172 %add.i = fadd float poison, 0.000000e+0073 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 !1574 %n.sroa.6.8.vec.extract2 = extractelement <2 x float> %0, i64 075 %add4.i = fadd float %n.sroa.6.8.vec.extract, 0.000000e+0076 call void @llvm.dbg.value(metadata <2 x float> undef, metadata !11, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg !1577 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 !1578 %add.i23 = fadd float 0.000000e+00, 0.000000e+0079 %ah.sroa.0.0.vec.insert = insertelement <2 x float> zeroinitializer, float %add4.i, i64 080 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)81 ret void82}83 84declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata)85declare void @llvm.dbg.value(metadata, metadata, metadata)86 87!llvm.dbg.cu = !{!0}88!llvm.module.flags = !{!2, !3, !4, !5, !6, !1000}89 90!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)91!1 = !DIFile(filename: "reduce.cpp", directory: "/")92!2 = !{i32 7, !"Dwarf Version", i32 5}93!3 = !{i32 2, !"Debug Info Version", i32 3}94!4 = !{i32 1, !"wchar_size", i32 4}95!5 = !{i32 7, !"uwtable", i32 1}96!6 = !{i32 7, !"frame-pointer", i32 2}97!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)98!8 = !DISubroutineType(types: !9)99!9 = !{null}100!10 = !{!11}101!11 = !DILocalVariable(name: "n", scope: !7, file: !1, line: 29, type: !12)102!12 = !DICompositeType(tag: DW_TAG_class_type, name: "a", file: !1, line: 1, size: 128, flags: DIFlagFwdDecl | DIFlagNonTrivial, identifier: "_ZTS1a")103!13 = !DILocation(line: 26, scope: !7)104!14 = distinct !DIAssignID()105!15 = !DILocation(line: 0, scope: !7)106!16 = distinct !DIAssignID()107!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}108