| 1 |
; RUN: llc < %s -O1 -stop-after=livedebugvalues -o - | FileCheck %s |
| 2 |
|
| 3 |
; This ll-file was created by: |
| 4 |
; clang --target=powerpc-apple-darwin9 -O1 -S -g -emit-llvm debuginfo-stackarg.c |
| 5 |
; |
| 6 |
; with debuginfo-stackarg.c being the program: |
| 7 |
; long long foo(long long bar1, long long bar2, long long bar3, long long bar4, long long bar5) |
| 8 |
; { |
| 9 |
; return bar1 + bar2 + bar3 + bar4 + bar5; |
| 10 |
; } |
| 11 |
|
| 12 |
; ModuleID = 'debuginfo-stackarg.c' |
| 13 |
source_filename = "debuginfo-stackarg.c" |
| 14 |
target datalayout = "E-m:o-p:32:32-f64:32:64-n32" |
| 15 |
;;;target triple = "powerpc-apple-macosx10.5.0" |
| 16 |
target triple = "powerpc-unknown-linux-gnu" |
| 17 |
|
| 18 |
; Function Attrs: nounwind readnone ssp uwtable |
| 19 |
define i64 @foo(i64 %bar1, i64 %bar2, i64 %bar3, i64 %bar4, i64 %bar5) local_unnamed_addr #0 !dbg !8 { |
| 20 |
; Variable bar5 should be associated with a position on the stack (offset relative r1). |
| 21 |
; Let's verify that we point out the start address (lowest address). |
| 22 |
; |
| 23 |
; First find the metadata id for bar5. |
| 24 |
; CHECK: !17 = !DILocalVariable(name: "bar5", arg: 5 |
| 25 |
; |
| 26 |
; Now check that we got two entries on the fixed stack with "expected" offsets. |
| 27 |
; CHECK-LABEL: fixedStack: |
| 28 |
; CHECK: id: 0, type: default, offset: 12, size: 4 |
| 29 |
; CHECK: id: 1, type: default, offset: 8, size: 4 |
| 30 |
; CHECK-NOT: id: 2 |
| 31 |
; CHECK-LABEL: stack: |
| 32 |
; |
| 33 |
; Finally check the resulting function body. |
| 34 |
; We expect to find a DBG_VALUE refering to the metadata id for bar5, using the lowest |
| 35 |
; of the two fixed stack offsets found earlier. |
| 36 |
; CHECK-LABEL: body: |
| 37 |
; CHECK: DBG_VALUE $r1, 0, !17, !DIExpression(DW_OP_plus_uconst, 8) |
| 38 |
entry: |
| 39 |
tail call void @llvm.dbg.value(metadata i64 %bar1, metadata !13, metadata !DIExpression()), !dbg !18 |
| 40 |
tail call void @llvm.dbg.value(metadata i64 %bar2, metadata !14, metadata !DIExpression()), !dbg !19 |
| 41 |
tail call void @llvm.dbg.value(metadata i64 %bar3, metadata !15, metadata !DIExpression()), !dbg !20 |
| 42 |
tail call void @llvm.dbg.value(metadata i64 %bar4, metadata !16, metadata !DIExpression()), !dbg !21 |
| 43 |
tail call void @llvm.dbg.value(metadata i64 %bar5, metadata !17, metadata !DIExpression()), !dbg !22 |
| 44 |
%add = add nsw i64 %bar2, %bar1, !dbg !23 |
| 45 |
%add1 = add nsw i64 %add, %bar3, !dbg !24 |
| 46 |
%add2 = add nsw i64 %add1, %bar4, !dbg !25 |
| 47 |
%add3 = add nsw i64 %add2, %bar5, !dbg !26 |
| 48 |
ret i64 %add3, !dbg !27 |
| 49 |
} |
| 50 |
|
| 51 |
; Function Attrs: nounwind readnone speculatable |
| 52 |
declare void @llvm.dbg.value(metadata, metadata, metadata) #1 |
| 53 |
|
| 54 |
attributes #0 = { nounwind readnone ssp uwtable } |
| 55 |
attributes #1 = { nounwind readnone speculatable } |
| 56 |
|
| 57 |
!llvm.dbg.cu = !{!0} |
| 58 |
!llvm.module.flags = !{!3, !4, !5, !6} |
| 59 |
!llvm.ident = !{!7} |
| 60 |
|
| 61 |
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) |
| 62 |
!1 = !DIFile(filename: "debuginfo-stackarg.c", directory: "/repo") |
| 63 |
!2 = !{} |
| 64 |
!3 = !{i32 2, !"Dwarf Version", i32 2} |
| 65 |
!4 = !{i32 2, !"Debug Info Version", i32 3} |
| 66 |
!5 = !{i32 1, !"wchar_size", i32 4} |
| 67 |
!6 = !{i32 7, !"PIC Level", i32 2} |
| 68 |
!7 = !{!"clang version 6.0.0"} |
| 69 |
!8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !9, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12) |
| 70 |
!9 = !DISubroutineType(types: !10) |
| 71 |
!10 = !{!11, !11, !11, !11, !11, !11} |
| 72 |
!11 = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed) |
| 73 |
!12 = !{!13, !14, !15, !16, !17} |
| 74 |
!13 = !DILocalVariable(name: "bar1", arg: 1, scope: !8, file: !1, line: 1, type: !11) |
| 75 |
!14 = !DILocalVariable(name: "bar2", arg: 2, scope: !8, file: !1, line: 1, type: !11) |
| 76 |
!15 = !DILocalVariable(name: "bar3", arg: 3, scope: !8, file: !1, line: 1, type: !11) |
| 77 |
!16 = !DILocalVariable(name: "bar4", arg: 4, scope: !8, file: !1, line: 1, type: !11) |
| 78 |
!17 = !DILocalVariable(name: "bar5", arg: 5, scope: !8, file: !1, line: 1, type: !11) |
| 79 |
!18 = !DILocation(line: 1, column: 25, scope: !8) |
| 80 |
!19 = !DILocation(line: 1, column: 41, scope: !8) |
| 81 |
!20 = !DILocation(line: 1, column: 57, scope: !8) |
| 82 |
!21 = !DILocation(line: 1, column: 73, scope: !8) |
| 83 |
!22 = !DILocation(line: 1, column: 89, scope: !8) |
| 84 |
!23 = !DILocation(line: 3, column: 15, scope: !8) |
| 85 |
!24 = !DILocation(line: 3, column: 22, scope: !8) |
| 86 |
!25 = !DILocation(line: 3, column: 29, scope: !8) |
| 87 |
!26 = !DILocation(line: 3, column: 36, scope: !8) |
| 88 |
!27 = !DILocation(line: 3, column: 3, scope: !8) |