[PATCH] D76279: [DebugInfo] Fix multi-byte entry values in call site values

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 18 05:24:55 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGa0a3a9c5a831: [DebugInfo] Fix multi-byte entry values in call site values (authored by dstenb).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76279/new/

https://reviews.llvm.org/D76279

Files:
  llvm/include/llvm/CodeGen/DIE.h
  llvm/test/DebugInfo/AArch64/dbgcall-site-float-entry-value.ll


Index: llvm/test/DebugInfo/AArch64/dbgcall-site-float-entry-value.ll
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/AArch64/dbgcall-site-float-entry-value.ll
@@ -0,0 +1,49 @@
+; RUN: llc -mtriple aarch64-linux-gnu -emit-call-site-info -debug-entry-values -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s
+
+; Based on the following C reproducer:
+;
+; extern void callee(float);
+;
+; void foo(float param) {
+;   callee(param);
+; }
+
+; Verify that a call site value using DW_OP_GNU_entry_value(DW_OP_regx B0) is
+; emitted for the float parameter. Previously the entry value's multi-byte
+; DW_OP_regx expression would be truncated.
+
+; CHECK: DW_TAG_GNU_call_site_parameter
+; CHECK-NEXT: DW_AT_location (DW_OP_regx B0)
+; CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_GNU_entry_value(DW_OP_regx B0)
+
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64"
+
+; Function Attrs: nounwind
+define dso_local void @foo(float %param) local_unnamed_addr !dbg !12 {
+entry:
+  tail call void @callee(float %param), !dbg !13
+  ret void, !dbg !14
+}
+
+declare !dbg !4 dso_local void @callee(float) local_unnamed_addr
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!8, !9, !10}
+!llvm.ident = !{!11}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "float.c", directory: "/")
+!2 = !{}
+!3 = !{!4}
+!4 = !DISubprogram(name: "callee", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
+!5 = !DISubroutineType(types: !6)
+!6 = !{null, !7}
+!7 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
+!8 = !{i32 7, !"Dwarf Version", i32 4}
+!9 = !{i32 2, !"Debug Info Version", i32 3}
+!10 = !{i32 1, !"wchar_size", i32 4}
+!11 = !{!"clang version 11.0.0 "}
+!12 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
+!13 = !DILocation(line: 4, scope: !12)
+!14 = !DILocation(line: 5, scope: !12)
Index: llvm/include/llvm/CodeGen/DIE.h
===================================================================
--- llvm/include/llvm/CodeGen/DIE.h
+++ llvm/include/llvm/CodeGen/DIE.h
@@ -551,10 +551,21 @@
   }
 
   void takeNodes(IntrusiveBackList<T> &Other) {
-    for (auto &N : Other) {
-      N.Next.setPointerAndInt(&N, true);
-      push_back(N);
-    }
+    if (Other.empty())
+      return;
+
+    T *FirstNode = static_cast<T *>(Other.Last->Next.getPointer());
+    T *IterNode = FirstNode;
+    do {
+      // Keep a pointer to the node and increment the iterator.
+      T *TmpNode = IterNode;
+      IterNode = static_cast<T *>(IterNode->Next.getPointer());
+
+      // Unlink the node and push it back to this list.
+      TmpNode->Next.setPointerAndInt(TmpNode, true);
+      push_back(*TmpNode);
+    } while (IterNode != FirstNode);
+
     Other.Last = nullptr;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76279.251044.patch
Type: text/x-patch
Size: 3238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200318/6433e579/attachment.bin>


More information about the llvm-commits mailing list