[llvm] r330167 - [DebugInfo] Follow-up bug fix on "Fixing a couple of DI duplication bugs of CloneModule"

Roman Tereshin via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 16 16:39:44 PDT 2018


Author: rtereshin
Date: Mon Apr 16 16:39:44 2018
New Revision: 330167

URL: http://llvm.org/viewvc/llvm-project?rev=330167&view=rev
Log:
[DebugInfo] Follow-up bug fix on "Fixing a couple of DI duplication bugs of CloneModule"

Apparently, DebugInfoFinder::processCompileUnit doesn't process all
of the possible kinds of DIImportedEntit'ies, e.g. DIGlobalVariable's.

Previously introduced `llvm_unreachable` is therefore incorrect.
Removing it here.

Added:
    llvm/trunk/test/DebugInfo/Generic/debuginfofinder-imported-global-variable.ll
Modified:
    llvm/trunk/lib/IR/DebugInfo.cpp

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=330167&r1=330166&r2=330167&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Apr 16 16:39:44 2018
@@ -101,8 +101,6 @@ void DebugInfoFinder::processCompileUnit
       processScope(NS->getScope());
     else if (auto *M = dyn_cast<DIModule>(Entity))
       processScope(M->getScope());
-    else
-      llvm_unreachable("unexpected imported entity type");
   }
 }
 

Added: llvm/trunk/test/DebugInfo/Generic/debuginfofinder-imported-global-variable.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/debuginfofinder-imported-global-variable.ll?rev=330167&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/debuginfofinder-imported-global-variable.ll (added)
+++ llvm/trunk/test/DebugInfo/Generic/debuginfofinder-imported-global-variable.ll Mon Apr 16 16:39:44 2018
@@ -0,0 +1,41 @@
+; RUN: opt -analyze -module-debuginfo < %s | FileCheck %s
+
+; This is to track DebugInfoFinder's ability to find the debug info metadata,
+; in particular, properly visit different kinds of DIImportedEntit'ies.
+
+; Derived from the following C++ snippet
+;
+; namespace s {
+;   int i;
+; }
+;
+; using s::i;
+;
+; compiled with `clang -O1 -g3 -emit-llvm -S`
+
+; CHECK: Printing analysis 'Decodes module-level debug info':
+; CHECK: Compile unit: DW_LANG_C_plus_plus from /somewhere/source.cpp
+; CHECK: Global variable: i from /somewhere/source.cpp:2 ('_ZN1s1iE')
+; CHECK: Type: int DW_ATE_signed
+
+ at _ZN1s1iE = local_unnamed_addr global i32 0, align 4, !dbg !0
+
+!llvm.dbg.cu = !{!5}
+!llvm.module.flags = !{!10, !11, !12, !13}
+!llvm.ident = !{!14}
+
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = distinct !DIGlobalVariable(name: "i", linkageName: "_ZN1s1iE", scope: !2, file: !3, line: 2, type: !4, isLocal: false, isDefinition: true)
+!2 = !DINamespace(name: "s", scope: null)
+!3 = !DIFile(filename: "source.cpp", directory: "/somewhere")
+!4 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.99 (https://git.llvm.org/git/clang.git/ ec45e6c6530b8f9a1046d0a7efae467b3151783b) (https://git.llvm.org/git/llvm.git/ 9d2fcc2bf4a301d05d9b440a805847645637ab28)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !6, globals: !7, imports: !8)
+!6 = !{}
+!7 = !{!0}
+!8 = !{!9}
+!9 = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !5, entity: !1, file: !3, line: 5)
+!10 = !{i32 2, !"Dwarf Version", i32 4}
+!11 = !{i32 2, !"Debug Info Version", i32 3}
+!12 = !{i32 1, !"wchar_size", i32 4}
+!13 = !{i32 7, !"PIC Level", i32 2}
+!14 = !{!"clang version 7.0.99 (https://git.llvm.org/git/clang.git/ ec45e6c6530b8f9a1046d0a7efae467b3151783b) (https://git.llvm.org/git/llvm.git/ 9d2fcc2bf4a301d05d9b440a805847645637ab28)"}




More information about the llvm-commits mailing list