[llvm-branch-commits] [llvm] 656c2b4 - [ClassicFlang] Add DebugInfo tests

Bryan Chan via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jun 24 08:40:59 PDT 2020


Author: Eric Schweitz
Date: 2020-06-23T06:29:57-04:00
New Revision: 656c2b405297f79baef81299b05fae143389c2b9

URL: https://github.com/llvm/llvm-project/commit/656c2b405297f79baef81299b05fae143389c2b9
DIFF: https://github.com/llvm/llvm-project/commit/656c2b405297f79baef81299b05fae143389c2b9.diff

LOG: [ClassicFlang] Add DebugInfo tests

Cherry-picked cabccf8f2d00daf1d740b18a1c80e9b5f4593f60.

Added: 
    llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll
    llvm/test/DebugInfo/Generic/more-subprogram-attr.ll
    llvm/test/DebugInfo/X86/DICommonBlock.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll b/llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll
new file mode 100644
index 000000000000..988c388fe218
--- /dev/null
+++ b/llvm/test/DebugInfo/Generic/fortran-subprogram-at.ll
@@ -0,0 +1,24 @@
+; Test for DIFlagPure, DIFlagElement and DIFlagRecursive. These three
+; DIFlags are used to attach DW_AT_pure, DW_AT_element, and DW_AT_recursive
+; attributes to DW_TAG_subprogram DIEs.
+
+; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
+; CHECK: !DISubprogram({{.*}}, spFlags: DISPFlagDefinition | DISPFlagPure | DISPFlagElemental | DISPFlagRecursive,
+
+!llvm.module.flags = !{!0, !1}
+!llvm.dbg.cu = !{!2}
+
+define void @subprgm() !dbg !6 {
+L:
+  ret void
+}
+
+!0 = !{i32 2, !"Dwarf Version", i32 2}
+!1 = !{i32 1, !"Debug Info Version", i32 3}
+!2 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !3, producer: "Flang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4, globals: !4, imports: !4)
+!3 = !DIFile(filename: "fortran-subprogram-at.f", directory: "/")
+!4 = !{}
+!5 = !DIBasicType(name: "real", size: 32, align: 32, encoding: DW_ATE_float)
+!6 = distinct !DISubprogram(name: "subprgm", scope: !2, file: !3, line: 256, type: !7, scopeLine: 256, spFlags: DISPFlagDefinition | DISPFlagPure | DISPFlagElemental | DISPFlagRecursive, unit: !2)
+!7 = !DISubroutineType(types: !8)
+!8 = !{null, !5}

diff  --git a/llvm/test/DebugInfo/Generic/more-subprogram-attr.ll b/llvm/test/DebugInfo/Generic/more-subprogram-attr.ll
new file mode 100644
index 000000000000..0533cf6b2367
--- /dev/null
+++ b/llvm/test/DebugInfo/Generic/more-subprogram-attr.ll
@@ -0,0 +1,38 @@
+; REQUIRES: object-emission
+
+; RUN: %llc_dwarf -O0 -filetype=obj < %s > %t
+; RUN: llvm-dwarfdump -v -debug-info %t | FileCheck %s
+
+; Make sure we're emitting DW_AT_{pure,elemental,recursive}.
+; CHECK: DW_TAG_subprogram
+; CHECK-NOT: {{DW_TAG|NULL}}
+; CHECK:   DW_AT_name {{.*}} "main"
+; CHECK-NOT: {{DW_TAG|NULL}}
+; CHECK:   DW_AT_pure [DW_FORM_flag_present] (true)
+; CHECK:   DW_AT_elemental [DW_FORM_flag_present] (true)
+; CHECK:   DW_AT_recursive [DW_FORM_flag_present] (true)
+
+define dso_local i32 @main() !dbg !7 {
+entry:
+  %retval = alloca i32, align 4
+  store i32 0, i32* %retval, align 4
+  ret i32 0, !dbg !12
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4, !5}
+!llvm.ident = !{!6}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
+!1 = !DIFile(filename: "x.c", directory: "/tmp")
+!2 = !{}
+!3 = !{i32 2, !"Dwarf Version", i32 4}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"wchar_size", i32 4}
+!6 = !{!"clang"}
+!7 = distinct !DISubprogram(name: "main", scope: !8, file: !8, line: 1, type: !9, scopeLine: 2, spFlags: DISPFlagDefinition | DISPFlagPure | DISPFlagElemental | DISPFlagRecursive, unit: !0, retainedNodes: !2)
+!8 = !DIFile(filename: "x.c", directory: "/tmp")
+!9 = !DISubroutineType(types: !10)
+!10 = !{!11}
+!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!12 = !DILocation(line: 3, column: 3, scope: !7)

diff  --git a/llvm/test/DebugInfo/X86/DICommonBlock.ll b/llvm/test/DebugInfo/X86/DICommonBlock.ll
new file mode 100644
index 000000000000..6b42d434af2d
--- /dev/null
+++ b/llvm/test/DebugInfo/X86/DICommonBlock.ll
@@ -0,0 +1,36 @@
+; ModuleID = 'none.f90'
+; RUN: llc %s -o %t -filetype=obj
+; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s
+; CHECK: DW_TAG_common_block
+
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx"
+
+ at common_a = common global [32 x i8] zeroinitializer, align 8, !dbg !13
+
+define i32 @subr() !dbg !9 {
+    %1 = getelementptr inbounds [32 x i8], [32 x i8]* @common_a, i64 0, i32 8
+    %2 = bitcast i8* %1 to i32*
+    %3 = load i32, i32* %2
+    ret i32 %3
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!6, !7}
+!llvm.ident = !{!8}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !1, producer: "PGI Fortran", isOptimized: false, runtimeVersion: 2, emissionKind: FullDebug, retainedTypes: !14, globals: !2)
+!1 = !DIFile(filename: "none.f90", directory: "/not/here/")
+!2 = !{!13}
+!3 = !{}
+!4 = !DIGlobalVariable(name: "common /a/", scope: !5, file: !1, line: 4, isLocal: false, isDefinition: true, type: !12)
+!5 = !DICommonBlock(scope: !9, declaration: !4, name: "a", file: !1, line: 4)
+!6 = !{i32 2, !"Dwarf Version", i32 4}
+!7 = !{i32 2, !"Debug Info Version", i32 3}
+!8 = !{!"PGI Fortran"}
+!9 = distinct !DISubprogram(name: "subrtn", scope: !0, file: !1, line: 1, type: !10, isLocal: false, isDefinition: true, unit: !0)
+!10 = !DISubroutineType(types: !11)
+!11 = !{!12, !12}
+!12 = !DIBasicType(name: "int", size: 32)
+!13 = !DIGlobalVariableExpression(var: !4, expr: !DIExpression())
+!14 = !{!12, !10}
\ No newline at end of file


        


More information about the llvm-branch-commits mailing list