2017-09-12 06:59:45 +08:00
; RUN: llc -mtriple=x86_64-linux-gnu -filetype=obj -o - %s | llvm-dwarfdump -debug-loc - | FileCheck %s
2017-08-03 19:54:02 +08:00
; The test inlines the function F four times, with each inlined variable for
; "i4" sharing the same virtual register. This means the live interval of the
; register spans all of the inlined callsites, extending beyond the lexical
; scope of each. Later during register allocation the live interval is split
; into multiple intervals. Check that this does not generate multiple entries
; within the debug location (see PR33730).
;
; Generated from:
;
; extern int foobar(int, int, int, int, int);
;
; int F(int i1, int i2, int i3, int i4, int i5) {
; return foobar(i1, i2, i3, i4, i5);
; }
;
; int foo(int a, int b, int c, int d, int e) {
; return F(a,b,c,d,e) +
; F(a,b,c,d,e) +
; F(a,b,c,d,e) +
; F(a,b,c,d,e);
; }
[dwarfdump] Pretty print location expressions and location lists
Summary:
Based on Fred's patch here: https://reviews.llvm.org/D6771
I can't seem to commandeer the old review, so I'm creating a new one.
With that change the locations exrpessions are pretty printed inline in the
DIE tree. The output looks like this for debug_loc entries:
DW_AT_location [DW_FORM_data4] (0x00000000
0x0000000000000001 - 0x000000000000000b: DW_OP_consts +3
0x000000000000000b - 0x0000000000000012: DW_OP_consts +7
0x0000000000000012 - 0x000000000000001b: DW_OP_reg0 RAX, DW_OP_piece 0x4
0x000000000000001b - 0x0000000000000024: DW_OP_breg5 RDI+0)
And like this for debug_loc.dwo entries:
DW_AT_location [DW_FORM_sec_offset] (0x00000000
Addr idx 2 (w/ length 190): DW_OP_consts +0, DW_OP_stack_value
Addr idx 3 (w/ length 23): DW_OP_reg0 RAX, DW_OP_piece 0x4)
Simple locations without ranges are printed inline:
DW_AT_location [DW_FORM_block1] (DW_OP_reg4 RSI, DW_OP_piece 0x4, DW_OP_bit_piece 0x20 0x0)
The debug_loc(.dwo) dumping in changed accordingly to factor the code.
Reviewers: dblaikie, aprantl, friss
Subscribers: mgorny, javed.absar, hiraditya, llvm-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D37123
llvm-svn: 312042
2017-08-30 05:41:21 +08:00
; CHECK: .debug_loc contents:
; CHECK-NEXT: 0x00000000:
2017-11-09 02:27:13 +08:00
; We currently emit an entry for the function prologue, too, which could be optimized away.
; CHECK: 0x000000000000001f - 0x000000000000003c: DW_OP_reg3 RBX
; We should only have one entry inside the function.
[dwarfdump] Pretty print location expressions and location lists
Summary:
Based on Fred's patch here: https://reviews.llvm.org/D6771
I can't seem to commandeer the old review, so I'm creating a new one.
With that change the locations exrpessions are pretty printed inline in the
DIE tree. The output looks like this for debug_loc entries:
DW_AT_location [DW_FORM_data4] (0x00000000
0x0000000000000001 - 0x000000000000000b: DW_OP_consts +3
0x000000000000000b - 0x0000000000000012: DW_OP_consts +7
0x0000000000000012 - 0x000000000000001b: DW_OP_reg0 RAX, DW_OP_piece 0x4
0x000000000000001b - 0x0000000000000024: DW_OP_breg5 RDI+0)
And like this for debug_loc.dwo entries:
DW_AT_location [DW_FORM_sec_offset] (0x00000000
Addr idx 2 (w/ length 190): DW_OP_consts +0, DW_OP_stack_value
Addr idx 3 (w/ length 23): DW_OP_reg0 RAX, DW_OP_piece 0x4)
Simple locations without ranges are printed inline:
DW_AT_location [DW_FORM_block1] (DW_OP_reg4 RSI, DW_OP_piece 0x4, DW_OP_bit_piece 0x20 0x0)
The debug_loc(.dwo) dumping in changed accordingly to factor the code.
Reviewers: dblaikie, aprantl, friss
Subscribers: mgorny, javed.absar, hiraditya, llvm-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D37123
llvm-svn: 312042
2017-08-30 05:41:21 +08:00
; CHECK-NOT: :
2017-08-03 19:54:02 +08:00
declare i32 @foobar ( i32 , i32 , i32 , i32 , i32 )
define i32 @foo ( i32 %a , i32 %b , i32 %c , i32 %d , i32 %e ) !dbg !25 {
entry:
tail call void @llvm.dbg.value ( metadata i32 %d , i64 0 , metadata !15 , metadata !17 ) #3 , !dbg !41
%call.i = tail call i32 @foobar ( i32 %a , i32 %b , i32 %c , i32 %d , i32 %e ) #3 , !dbg !43
%call.i21 = tail call i32 @foobar ( i32 %a , i32 %b , i32 %c , i32 %d , i32 %e ) #3 , !dbg !50
%add = add nsw i32 %call.i21 , %call.i , !dbg !51
%call.i22 = tail call i32 @foobar ( i32 %a , i32 %b , i32 %c , i32 %d , i32 %e ) #3 , !dbg !58
%add3 = add nsw i32 %add , %call.i22 , !dbg !59
%call.i23 = tail call i32 @foobar ( i32 %a , i32 %b , i32 %c , i32 %d , i32 %e ) #3 , !dbg !66
%add5 = add nsw i32 %add3 , %call.i23 , !dbg !67
ret i32 %add5 , !dbg !68
}
declare void @llvm.dbg.value ( metadata , i64 , metadata , metadata )
!llvm.dbg.cu = ! { !0 }
!llvm.module.flags = ! { !3 , !4 , !5 }
!llvm.ident = ! { !6 }
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C 99 , file: !1 , producer: "clang version 6.0.0 (trunk 308976)" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !2 )
!1 = !DIFile ( filename: "foo.c" , directory: "" )
!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 version 6.0.0 (trunk 308976)" }
!7 = distinct !DISubprogram ( name: "F" , scope: !1 , file: !1 , line: 3 , type: !8 , isLocal: false , isDefinition: true , scopeLine: 3 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !0 , variables: !11 )
!8 = !DISubroutineType ( types: !9 )
!9 = ! { !10 , !10 , !10 , !10 , !10 , !10 }
!10 = !DIBasicType ( name: "int" , size: 32 , encoding: D W _ A T E _ s i g n e d )
!11 = ! { !15 }
!15 = !DILocalVariable ( name: "i4" , arg: 4 , scope: !7 , file: !1 , line: 3 , type: !10 )
!17 = !DIExpression ( )
!25 = distinct !DISubprogram ( name: "foo" , scope: !1 , file: !1 , line: 7 , type: !8 , isLocal: false , isDefinition: true , scopeLine: 7 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !0 , variables: !26 )
!26 = ! { }
!38 = distinct !DILocation ( line: 8 , column: 10 , scope: !25 )
!41 = !DILocation ( line: 3 , column: 35 , scope: !7 , inlinedAt: !38 )
!43 = !DILocation ( line: 4 , column: 10 , scope: !7 , inlinedAt: !38 )
!45 = distinct !DILocation ( line: 9 , column: 10 , scope: !25 )
!50 = !DILocation ( line: 4 , column: 10 , scope: !7 , inlinedAt: !45 )
!51 = !DILocation ( line: 8 , column: 23 , scope: !25 )
!53 = distinct !DILocation ( line: 10 , column: 10 , scope: !25 )
!58 = !DILocation ( line: 4 , column: 10 , scope: !7 , inlinedAt: !53 )
!59 = !DILocation ( line: 9 , column: 23 , scope: !25 )
!61 = distinct !DILocation ( line: 11 , column: 10 , scope: !25 )
!66 = !DILocation ( line: 4 , column: 10 , scope: !7 , inlinedAt: !61 )
!67 = !DILocation ( line: 10 , column: 23 , scope: !25 )
!68 = !DILocation ( line: 8 , column: 3 , scope: !25 )