[llvm] Fix merging of debug_str_offsets with multiple contributions (PR #90461)

Morten larsen via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 06:55:48 PDT 2024


https://github.com/molar updated https://github.com/llvm/llvm-project/pull/90461

>From 7d7e44e80d51a9cbccee822ef6f193b07139561e Mon Sep 17 00:00:00 2001
From: Morten Larsen <mortenlarsens at gmail.com>
Date: Thu, 18 Apr 2024 21:33:27 +0200
Subject: [PATCH 1/2] Fix merging of debug_str_offsets with multiple
 contributions in the section added test of merging contributions in
 debug_str_offsets

---
 llvm/lib/DWP/DWP.cpp                          |  42 +++++++++++----
 .../llvm-dwp/Inputs/merge_v5/notypes/ab.dwp   | Bin 0 -> 1240 bytes
 .../llvm-dwp/Inputs/merge_v5/notypes/c.dwo    | Bin 0 -> 800 bytes
 llvm/test/tools/llvm-dwp/X86/merge.test       |   5 ++
 llvm/test/tools/llvm-dwp/X86/merge_v5.test    |  48 ++++++++++++++++++
 5 files changed, 86 insertions(+), 9 deletions(-)
 create mode 100644 llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/ab.dwp
 create mode 100644 llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/c.dwo
 create mode 100644 llvm/test/tools/llvm-dwp/X86/merge_v5.test

diff --git a/llvm/lib/DWP/DWP.cpp b/llvm/lib/DWP/DWP.cpp
index 77bd22d1f071c..fecd184ca68a8 100644
--- a/llvm/lib/DWP/DWP.cpp
+++ b/llvm/lib/DWP/DWP.cpp
@@ -415,6 +415,17 @@ Expected<InfoSectionUnitHeader> parseInfoSectionUnitHeader(StringRef Info) {
   return Header;
 }
 
+static void writeNewOffsetsTo(MCStreamer &Out, DataExtractor &Data,
+                              DenseMap<uint64_t, uint32_t> &OffsetRemapping,
+                              uint64_t &Offset, uint64_t &Size) {
+
+  while (Offset < Size) {
+    auto OldOffset = Data.getU32(&Offset);
+    auto NewOffset = OffsetRemapping[OldOffset];
+    Out.emitIntValue(NewOffset, 4);
+  }
+}
+
 void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
                             MCSection *StrOffsetSection,
                             StringRef CurStrSection,
@@ -439,17 +450,30 @@ void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
 
   Out.switchSection(StrOffsetSection);
 
-  uint64_t HeaderSize = debugStrOffsetsHeaderSize(Data, Version);
   uint64_t Offset = 0;
   uint64_t Size = CurStrOffsetSection.size();
-  // FIXME: This can be caused by bad input and should be handled as such.
-  assert(HeaderSize <= Size && "StrOffsetSection size is less than its header");
-  // Copy the header to the output.
-  Out.emitBytes(Data.getBytes(&Offset, HeaderSize));
-  while (Offset < Size) {
-    auto OldOffset = Data.getU32(&Offset);
-    auto NewOffset = OffsetRemapping[OldOffset];
-    Out.emitIntValue(NewOffset, 4);
+  if (Version > 4) {
+    while (Offset < Size) {
+      uint64_t HeaderSize = debugStrOffsetsHeaderSize(Data, Version);
+      assert(HeaderSize <= Size - Offset &&
+             "StrOffsetSection size is less than its header");
+
+      uint64_t ContributionEnd = 0;
+      uint64_t ContributionSize = 0;
+      uint64_t HeaderLengthOffset = Offset;
+      if (HeaderSize == 8) {
+        ContributionSize = Data.getU32(&HeaderLengthOffset);
+      } else if (HeaderSize == 16) {
+        HeaderLengthOffset += 4; // skip the dwarf64 marker
+        ContributionSize = Data.getU64(&HeaderLengthOffset);
+      }
+      ContributionEnd = ContributionSize + HeaderLengthOffset;
+      Out.emitBytes(Data.getBytes(&Offset, HeaderSize));
+      writeNewOffsetsTo(Out, Data, OffsetRemapping, Offset, ContributionEnd);
+    }
+
+  } else {
+    writeNewOffsetsTo(Out, Data, OffsetRemapping, Offset, Size);
   }
 }
 
diff --git a/llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/ab.dwp b/llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/ab.dwp
new file mode 100644
index 0000000000000000000000000000000000000000..a2388f0e37dff07fa401a80ca9b91b56bbdc145f
GIT binary patch
literal 1240
zcmb_b!EVz)5FM}Ms!~oNmsD_YRaq(uHFlh)X$vG00x1#)IDiB_M0Vn&5!8<CBoqm?
z5&S^8aqS0i=MOk?;lStc#@$Vf51bh3?aaJ+v+EseFP}VnDm0ChY4nKJnPQ24i*?-1
z!Y*w>sZ}(~sv5eru!uyHbgNhGY#o)4%c4f4SE*Ijt#X+Obp5TiwaV>V8{JxD=@tt*
zTj(%I)Hvx?iAsfbpGI*^FN1kBo124oel#{0VUkYb$aLGbYkTHyz20ydO~-3AoCD9@
z_v+!OHFU#)b1-Nf?ztD?`P98o68F&a9LH|A?vig0rc<oL_c8U~xPce=2?dm`St-a$
zxDy%K^>JJH4d4Xufja=##=sOv0In~9kH9Wqkg*9z_Q_Xw at 8R{8Cbmg03BvHOp}5BV
z at iR1PB30TK-+z7nakc+g)3>Q)h-^>o6+}W8UoJ_w+=~MD@%cKy-&O*YsXf%Wif7MS
z^~>3FKYw at L?jf-OzGFUaBkuqv at Nct+VK5)}2lM_U8iwa2b3X`@aFNYcGU+Vo$D>gi
z&e8&%PbbkRzR97V`2pGKhcov7$zEe09z at Yjd0Mc^ja#j1fQqOfkla#n?7K2KlU})E
z{}BqzIYdjPVgF4gpYkMP)vx@{np at _j_od)Lo?L5JY;VmiS0sYBvVWK-5vy|*&3TdI
g+D}RHgUDM^>!T<~otM#bN%BKv<32|As^As>2Mxt`WdHyG

literal 0
HcmV?d00001

diff --git a/llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/c.dwo b/llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/c.dwo
new file mode 100644
index 0000000000000000000000000000000000000000..e58a4b0c34d0bbda67317948772c410217a6722e
GIT binary patch
literal 800
zcmb`E%SyvQ6oyZ3RY(`siYRU(G at uqkCedCLYc>i2K@@bMi;`=pN>ZCNii_Gu at sZrP
z at o79sCp83@4xE|ufAgQ2!_52H#W~9`kPilW at T+nP@KJz9h7G8oQ^H)xG at u4p#;9Vf
zV0ajh82vlqB;dd>h{3kr;KrT=@kDZ-tY9D|-Z&bDfkZkAQFLji+0<0+K-D!(ZR_Mv
zZ+d>qC7z?UomO|BOug3;ndTPK)pb=>I;~xB6lXNT*?kE?$4dne(q7>D;dAM7?f#qL
zw?U||S(D5ycFykME~ljvFgz>pz|<I7t_z%;$N;PYwXM~Pu at T6ed?X%=X8m*%z3X7s
z=Kz3j04MiEQA{sVT+f~i`j%~vy(DXck|-YcL*I|QI4a?y90q<k*XWNeJ3aCrhKXlz
zf1G2||GX;g6}~y!spCx9tY|f;XcQsl<@)rIQ>FsUa9IqOX3q;UPxAVF?INc6tZ4nB
XqFscT=XE(w^<VW>3Quw)UCZ at 9CP7eK

literal 0
HcmV?d00001

diff --git a/llvm/test/tools/llvm-dwp/X86/merge.test b/llvm/test/tools/llvm-dwp/X86/merge.test
index 0cf56bd858a04..25a1315ee63f3 100644
--- a/llvm/test/tools/llvm-dwp/X86/merge.test
+++ b/llvm/test/tools/llvm-dwp/X86/merge.test
@@ -44,3 +44,8 @@ CHECK:    Index  Signature INFO                                        ABBREV
 CHECK-DAG:       [[DWOC]]  [0x00000000[[#COFF]], 0x00000000[[#AOFF]]) [0x0000[[CAOFF]], 0x0000[[AAOFF]]) [0x00000000, 0x00000011) [0x00000000, 0x00000018)
 CHECK-DAG:       [[DWOA]]  [0x00000000[[#AOFF]], 0x00000000[[#BOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000011, 0x00000022) [0x00000018, 0x00000028)
 CHECK-DAG:       [[DWOB]]  [0x00000000[[#BOFF]], 0x00000000[[#XOFF]]) [0x0000[[BAOFF]], 0x000000c3)      [0x00000022, 0x00000033) [0x00000028, 0x0000003c)
+
+CHECK-LABEL: .debug_str_offsets.dwo contents:
+CHECK: Contribution size = 24, Format = DWARF32, Version = 4
+CHECK: Contribution size = 16, Format = DWARF32, Version = 4
+CHECK: Contribution size = 20, Format = DWARF32, Version = 4
diff --git a/llvm/test/tools/llvm-dwp/X86/merge_v5.test b/llvm/test/tools/llvm-dwp/X86/merge_v5.test
new file mode 100644
index 0000000000000..ea9ef030e5d05
--- /dev/null
+++ b/llvm/test/tools/llvm-dwp/X86/merge_v5.test
@@ -0,0 +1,48 @@
+RUN: llvm-dwp %p/../Inputs/merge_v5/notypes/c.dwo %p/../Inputs/merge_v5/notypes/ab.dwp -o - | \
+RUN:   llvm-dwarfdump -v - | FileCheck --check-prefix=CHECK %s
+
+DWP from a DWO (c.dwo) and a DWP (ab.dwp, created from a.dwo and b.dwo)
+Make sure the entries for A and B are updated correctly when read/processed from ab.dwp
+a.cpp:
+  struct foo { };
+  foo a;
+
+b.cpp:
+  struct bar { };
+  void b(bar) {
+  }
+
+c.cpp:
+  typedef int baz;
+  baz c() {
+  }
+
+CHECK-LABEL: .debug_abbrev.dwo contents:
+CHECK-LABEL: Abbrev table for offset:
+CHECK: 0x0000[[CAOFF:.*]]
+CHECK-LABEL: Abbrev table for offset:
+CHECK: 0x0000[[AAOFF:.*]]
+CHECK-LABEL: Abbrev table for offset:
+CHECK: 0x0000[[BAOFF:.*]]
+
+CHECK: .debug_info.dwo contents:
+CHECK: 0x[[#%.8x,COFF:]]:
+CHECK-LABEL: Compile Unit: length = {{.*}}, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_compile, abbr_offset =
+CHECK:         0x[[CAOFF]], addr_size = 0x08, DWO_id = 0x[[DWOC:.*]] (next unit at 0x[[#%.8x,BOFF:]])
+CHECK: [[#BOFF]]:
+CHECK-LABEL: Compile Unit: length = {{.*}}, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_compile, abbr_offset =
+CHECK:         0x[[BAOFF]], addr_size = 0x08, DWO_id = 0x[[DWOB:.*]] (next unit at 0x[[#%.8x,AOFF:]])
+CHECK: [[#AOFF]]:
+CHECK-LABEL: Compile Unit: length = {{.*}}, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_compile, abbr_offset =
+CHECK:         0x[[AAOFF]], addr_size = 0x08, DWO_id = 0x[[DWOA:.*]] (next unit at 0x[[#%.8x,XOFF:]])
+
+CHECK-LABEL: .debug_cu_index contents:
+CHECK:    Index Signature          INFO                                     ABBREV                                  STR_OFFSETS 
+CHECK-DAG:       [[DWOC]]  [0x00000000[[#COFF]], 0x00000000[[#BOFF]]) [0x0000[[CAOFF]], 0x0000[[AAOFF]]) [0x00000000, 0x00000024) 
+CHECK-DAG:       [[DWOB]]  [0x00000000[[#BOFF]], 0x00000000[[#AOFF]]) [0x0000[[BAOFF]],  
+CHECK-DAG:       [[DWOA]]  [0x00000000[[#AOFF]], 0x00000000[[#XOFF]]) [0x0000[[AAOFF]], 
+
+CHECK-LABEL: .debug_str_offsets.dwo contents:
+CHECK: Contribution size = 32, Format = DWARF32, Version = 5
+CHECK: Contribution size = 24, Format = DWARF32, Version = 5
+CHECK: Contribution size = 28, Format = DWARF32, Version = 5

>From 784769390478b664ed10b42cdfa5d73e7199370d Mon Sep 17 00:00:00 2001
From: mla <mortenlarsens at gmail.com>
Date: Thu, 16 May 2024 14:40:02 +0200
Subject: [PATCH 2/2] add test that uses elaborated test infrastructure

---
 .../llvm-dwp/Inputs/merge_v5/notypes/ab.dwp   | Bin 1240 -> 0 bytes
 .../llvm-dwp/Inputs/merge_v5/notypes/c.dwo    | Bin 800 -> 0 bytes
 llvm/test/tools/llvm-dwp/X86/merge_v5.test    | 149 +++++++++++++++---
 3 files changed, 131 insertions(+), 18 deletions(-)
 delete mode 100644 llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/ab.dwp
 delete mode 100644 llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/c.dwo

diff --git a/llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/ab.dwp b/llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/ab.dwp
deleted file mode 100644
index a2388f0e37dff07fa401a80ca9b91b56bbdc145f..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 1240
zcmb_b!EVz)5FM}Ms!~oNmsD_YRaq(uHFlh)X$vG00x1#)IDiB_M0Vn&5!8<CBoqm?
z5&S^8aqS0i=MOk?;lStc#@$Vf51bh3?aaJ+v+EseFP}VnDm0ChY4nKJnPQ24i*?-1
z!Y*w>sZ}(~sv5eru!uyHbgNhGY#o)4%c4f4SE*Ijt#X+Obp5TiwaV>V8{JxD=@tt*
zTj(%I)Hvx?iAsfbpGI*^FN1kBo124oel#{0VUkYb$aLGbYkTHyz20ydO~-3AoCD9@
z_v+!OHFU#)b1-Nf?ztD?`P98o68F&a9LH|A?vig0rc<oL_c8U~xPce=2?dm`St-a$
zxDy%K^>JJH4d4Xufja=##=sOv0In~9kH9Wqkg*9z_Q_Xw at 8R{8Cbmg03BvHOp}5BV
z at iR1PB30TK-+z7nakc+g)3>Q)h-^>o6+}W8UoJ_w+=~MD@%cKy-&O*YsXf%Wif7MS
z^~>3FKYw at L?jf-OzGFUaBkuqv at Nct+VK5)}2lM_U8iwa2b3X`@aFNYcGU+Vo$D>gi
z&e8&%PbbkRzR97V`2pGKhcov7$zEe09z at Yjd0Mc^ja#j1fQqOfkla#n?7K2KlU})E
z{}BqzIYdjPVgF4gpYkMP)vx@{np at _j_od)Lo?L5JY;VmiS0sYBvVWK-5vy|*&3TdI
g+D}RHgUDM^>!T<~otM#bN%BKv<32|As^As>2Mxt`WdHyG

diff --git a/llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/c.dwo b/llvm/test/tools/llvm-dwp/Inputs/merge_v5/notypes/c.dwo
deleted file mode 100644
index e58a4b0c34d0bbda67317948772c410217a6722e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 800
zcmb`E%SyvQ6oyZ3RY(`siYRU(G at uqkCedCLYc>i2K@@bMi;`=pN>ZCNii_Gu at sZrP
z at o79sCp83@4xE|ufAgQ2!_52H#W~9`kPilW at T+nP@KJz9h7G8oQ^H)xG at u4p#;9Vf
zV0ajh82vlqB;dd>h{3kr;KrT=@kDZ-tY9D|-Z&bDfkZkAQFLji+0<0+K-D!(ZR_Mv
zZ+d>qC7z?UomO|BOug3;ndTPK)pb=>I;~xB6lXNT*?kE?$4dne(q7>D;dAM7?f#qL
zw?U||S(D5ycFykME~ljvFgz>pz|<I7t_z%;$N;PYwXM~Pu at T6ed?X%=X8m*%z3X7s
z=Kz3j04MiEQA{sVT+f~i`j%~vy(DXck|-YcL*I|QI4a?y90q<k*XWNeJ3aCrhKXlz
zf1G2||GX;g6}~y!spCx9tY|f;XcQsl<@)rIQ>FsUa9IqOX3q;UPxAVF?INc6tZ4nB
XqFscT=XE(w^<VW>3Quw)UCZ at 9CP7eK

diff --git a/llvm/test/tools/llvm-dwp/X86/merge_v5.test b/llvm/test/tools/llvm-dwp/X86/merge_v5.test
index ea9ef030e5d05..5c65407c8f573 100644
--- a/llvm/test/tools/llvm-dwp/X86/merge_v5.test
+++ b/llvm/test/tools/llvm-dwp/X86/merge_v5.test
@@ -1,21 +1,10 @@
-RUN: llvm-dwp %p/../Inputs/merge_v5/notypes/c.dwo %p/../Inputs/merge_v5/notypes/ab.dwp -o - | \
-RUN:   llvm-dwarfdump -v - | FileCheck --check-prefix=CHECK %s
-
-DWP from a DWO (c.dwo) and a DWP (ab.dwp, created from a.dwo and b.dwo)
-Make sure the entries for A and B are updated correctly when read/processed from ab.dwp
-a.cpp:
-  struct foo { };
-  foo a;
-
-b.cpp:
-  struct bar { };
-  void b(bar) {
-  }
-
-c.cpp:
-  typedef int baz;
-  baz c() {
-  }
+RUN: rm -rf %t && split-file %s %t && cd %t
+RUN: llc a.ll -o a.o -filetype=obj --split-dwarf-output=a.dwo --split-dwarf-file=a.dwo
+RUN: llc b.ll -o b.o -filetype=obj --split-dwarf-output=b.dwo --split-dwarf-file=b.dwo
+RUN: llc c.ll -o c.o -filetype=obj --split-dwarf-output=c.dwo --split-dwarf-file=c.dwo
+RUN: llvm-dwp a.dwo b.dwo -o ab.dwp
+RUN: llvm-dwp c.dwo ab.dwp -o merged.dwp
+RUN: llvm-dwarfdump -v merged.dwp | FileCheck --check-prefix=CHECK %s
 
 CHECK-LABEL: .debug_abbrev.dwo contents:
 CHECK-LABEL: Abbrev table for offset:
@@ -46,3 +35,127 @@ CHECK-LABEL: .debug_str_offsets.dwo contents:
 CHECK: Contribution size = 32, Format = DWARF32, Version = 5
 CHECK: Contribution size = 24, Format = DWARF32, Version = 5
 CHECK: Contribution size = 28, Format = DWARF32, Version = 5
+
+DWP from a DWO (c.dwo) and a DWP (ab.dwp, created from a.dwo and b.dwo)
+Make sure the entries for A and B are updated correctly when read/processed from ab.dwp
+;--- a.cpp
+  struct foo { };
+  foo a;
+;--- b.cpp
+  struct bar { };
+  void b(bar) {
+  }
+;--- c.cpp
+  typedef int baz;
+  baz c() {
+  }
+;--- gen
+clang-18  --target=x86_64-linux  -g3 -gsplit-dwarf -S -emit-llvm -gsplit-dwarf  a.cpp -o -
+echo '#--- b.ll'
+clang-18  --target=x86_64-linux  -g3 -gsplit-dwarf -S -emit-llvm -gsplit-dwarf  b.cpp -o -
+echo '#--- c.ll'
+clang-18  --target=x86_64-linux  -g3 -gsplit-dwarf -S -emit-llvm -gsplit-dwarf  c.cpp -o -
+;--- a.ll
+; ModuleID = 'a.cpp'
+source_filename = "a.cpp"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux"
+
+%struct.foo = type { i8 }
+
+ at a = dso_local global %struct.foo zeroinitializer, align 1, !dbg !0
+
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!7, !8, !9, !10, !11, !12, !13}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 2, type: !5, isLocal: false, isDefinition: true)
+!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, isOptimized: false, runtimeVersion: 0, splitDebugFilename: "a.dwo", emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: GNU)
+!3 = !DIFile(filename: "a.cpp", directory: "/proc/self/cwd", checksumkind: CSK_MD5, checksum: "394299a94a96cb48c0c9c95d7baf01f5")
+!4 = !{!0}
+!5 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo", file: !3, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !6, identifier: "_ZTS3foo")
+!6 = !{}
+!7 = !{i32 7, !"Dwarf Version", i32 5}
+!8 = !{i32 2, !"Debug Info Version", i32 3}
+!9 = !{i32 1, !"wchar_size", i32 4}
+!10 = !{i32 8, !"PIC Level", i32 2}
+!11 = !{i32 7, !"PIE Level", i32 2}
+!12 = !{i32 7, !"uwtable", i32 2}
+!13 = !{i32 7, !"frame-pointer", i32 2}
+#--- b.ll
+; ModuleID = 'b.cpp'
+source_filename = "b.cpp"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux"
+
+%struct.bar = type { i8 }
+
+; Function Attrs: mustprogress noinline nounwind optnone uwtable
+define dso_local void @_Z1b3bar() #0 !dbg !9 {
+  %1 = alloca %struct.bar, align 1
+  call void @llvm.dbg.declare(metadata ptr %1, metadata !14, metadata !DIExpression()), !dbg !15
+  ret void, !dbg !16
+}
+
+; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
+
+attributes #0 = { mustprogress noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, isOptimized: false, runtimeVersion: 0, splitDebugFilename: "b.dwo", emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: GNU)
+!1 = !DIFile(filename: "b.cpp", directory: "/proc/self/cwd", checksumkind: CSK_MD5, checksum: "8195382ac12baa5edfe47e2e4725f4a7")
+!2 = !{i32 7, !"Dwarf Version", i32 5}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
+!4 = !{i32 1, !"wchar_size", i32 4}
+!5 = !{i32 8, !"PIC Level", i32 2}
+!6 = !{i32 7, !"PIE Level", i32 2}
+!7 = !{i32 7, !"uwtable", i32 2}
+!8 = !{i32 7, !"frame-pointer", i32 2}
+!9 = distinct !DISubprogram(name: "b", linkageName: "_Z1b3bar", scope: !1, file: !1, line: 2, type: !10, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !13)
+!10 = !DISubroutineType(types: !11)
+!11 = !{null, !12}
+!12 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "bar", file: !1, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !13, identifier: "_ZTS3bar")
+!13 = !{}
+!14 = !DILocalVariable(arg: 1, scope: !9, file: !1, line: 2, type: !12)
+!15 = !DILocation(line: 2, column: 13, scope: !9)
+!16 = !DILocation(line: 3, column: 3, scope: !9)
+#--- c.ll
+; ModuleID = 'c.cpp'
+source_filename = "c.cpp"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux"
+
+; Function Attrs: mustprogress noinline nounwind optnone uwtable
+define dso_local noundef i32 @_Z1cv() #0 !dbg !9 {
+  call void @llvm.trap(), !dbg !14
+  unreachable, !dbg !14
+}
+
+; Function Attrs: cold noreturn nounwind memory(inaccessiblemem: write)
+declare void @llvm.trap() #1
+
+attributes #0 = { mustprogress noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #1 = { cold noreturn nounwind memory(inaccessiblemem: write) }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, isOptimized: false, runtimeVersion: 0, splitDebugFilename: "c.dwo", emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: GNU)
+!1 = !DIFile(filename: "c.cpp", directory: "/proc/self/cwd", checksumkind: CSK_MD5, checksum: "e508eeb01e2e608fe8713f9132696ef5")
+!2 = !{i32 7, !"Dwarf Version", i32 5}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
+!4 = !{i32 1, !"wchar_size", i32 4}
+!5 = !{i32 8, !"PIC Level", i32 2}
+!6 = !{i32 7, !"PIE Level", i32 2}
+!7 = !{i32 7, !"uwtable", i32 2}
+!8 = !{i32 7, !"frame-pointer", i32 2}
+!9 = distinct !DISubprogram(name: "c", linkageName: "_Z1cv", scope: !1, file: !1, line: 2, type: !10, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
+!10 = !DISubroutineType(types: !11)
+!11 = !{!12}
+!12 = !DIDerivedType(tag: DW_TAG_typedef, name: "baz", file: !1, line: 1, baseType: !13)
+!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!14 = !DILocation(line: 2, column: 11, scope: !9)



More information about the llvm-commits mailing list