[GlobalISel] Lower dbg.declare into indirect DBG_VALUE
Summary:
D31439 changed the semantics of dbg.declare to take the address of a
variable as the first argument, making it indirect. It specifically
updated FastISel for this change here:
https://reviews.llvm.org/D31439#change-WVArzi177jPl
GlobalISel needs to follow suit, or else it will be missing a level of
indirection in the generated debuginfo. This problem was seen in a Rust
debuginfo test on aarch64, since GlobalISel is used at -O0 for aarch64.
https://github.com/rust-lang/rust/issues/49807
https://bugzilla.redhat.com/show_bug.cgi?id=1611597
https://bugzilla.redhat.com/show_bug.cgi?id=1625768
Reviewers: dblaikie, aprantl, t.p.northover, javed.absar, rnk
Reviewed By: rnk
Subscribers: #debug-info, rovka, kristof.beyls, JDevlieghere, llvm-commits, tstellar
Differential Revision: https://reviews.llvm.org/D51749
llvm-svn: 341969
2018-09-12 01:52:01 +08:00
; RUN: llc -global-isel -mtriple=aarch64 %s -stop-after=irtranslator -o - | FileCheck %s
; RUN: llc -mtriple=aarch64 -global-isel --global-isel-abort=0 -o /dev/null
; struct NTCopy {
; NTCopy();
; NTCopy(const NTCopy &);
; int x;
; };
; int foo(NTCopy o) {
; return o.x;
; }
; ModuleID = 'ntcopy.cpp'
source_filename = "ntcopy.cpp"
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-linux-gnu"
%struct.NTCopy = type { i32 }
; CHECK-LABEL: name: _Z3foo6NTCopy
2018-10-31 07:28:27 +08:00
; CHECK: DBG_VALUE %{{[0-9]+}}(p0), 0, !23, !DIExpression(), debug-location !24
[GlobalISel] Lower dbg.declare into indirect DBG_VALUE
Summary:
D31439 changed the semantics of dbg.declare to take the address of a
variable as the first argument, making it indirect. It specifically
updated FastISel for this change here:
https://reviews.llvm.org/D31439#change-WVArzi177jPl
GlobalISel needs to follow suit, or else it will be missing a level of
indirection in the generated debuginfo. This problem was seen in a Rust
debuginfo test on aarch64, since GlobalISel is used at -O0 for aarch64.
https://github.com/rust-lang/rust/issues/49807
https://bugzilla.redhat.com/show_bug.cgi?id=1611597
https://bugzilla.redhat.com/show_bug.cgi?id=1625768
Reviewers: dblaikie, aprantl, t.p.northover, javed.absar, rnk
Reviewed By: rnk
Subscribers: #debug-info, rovka, kristof.beyls, JDevlieghere, llvm-commits, tstellar
Differential Revision: https://reviews.llvm.org/D51749
llvm-svn: 341969
2018-09-12 01:52:01 +08:00
; Function Attrs: noinline nounwind optnone
define d s o _ l o c a l i32 @_Z3foo6NTCopy ( %struct.NTCopy * %o ) #0 !dbg !7 {
entry:
call void @llvm.dbg.declare ( metadata %struct.NTCopy * %o , metadata !23 , metadata !DIExpression ( ) ) , !dbg !24
%x = getelementptr inbounds %struct.NTCopy , %struct.NTCopy * %o , i32 0 , i32 0 , !dbg !25
%0 = load i32 , i32 * %x , align 4 , !dbg !25
ret i32 %0 , !dbg !26
}
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare ( metadata , metadata , metadata ) #1
attributes #0 = { noinline nounwind optnone }
attributes #1 = { nounwind readnone s p e c u l a t a b l e }
!llvm.dbg.cu = ! { !0 }
!llvm.module.flags = ! { !3 , !4 , !5 }
!llvm.ident = ! { !6 }
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , file: !1 , producer: "clang version 8.0.0 " , isOptimized: false , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !2 , nameTableKind: N one )
!1 = !DIFile ( filename: "ntcopy.cpp" , 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 version 8.0.0 " }
!7 = distinct !DISubprogram ( name: "foo" , linkageName: "_Z3foo6NTCopy" , scope: !1 , file: !1 , line: 6 , type: !8 , isLocal: false , isDefinition: true , scopeLine: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: false , unit: !0 , retainedNodes: !2 )
!8 = !DISubroutineType ( types: !9 )
!9 = ! { !10 , !11 }
!10 = !DIBasicType ( name: "int" , size: 32 , encoding: D W _ A T E _ s i g n e d )
!11 = distinct !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , name: "NTCopy" , file: !1 , line: 1 , size: 32 , flags: D I F l a g T y p e P a s s B y R e f e r e n c e , elements: !12 , identifier: "_ZTS6NTCopy" )
!12 = ! { !13 , !14 , !18 }
!13 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "x" , scope: !11 , file: !1 , line: 4 , baseType: !10 , size: 32 )
!14 = !DISubprogram ( name: "NTCopy" , scope: !11 , file: !1 , line: 2 , type: !15 , isLocal: false , isDefinition: false , scopeLine: 2 , flags: D I F l a g P r o t o t y p e d , isOptimized: false )
!15 = !DISubroutineType ( types: !16 )
!16 = ! { null , !17 }
!17 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , baseType: !11 , size: 64 , flags: D I F l a g A r t i f i c i a l | D I F l a g O b j e c t P o i n t e r )
!18 = !DISubprogram ( name: "NTCopy" , scope: !11 , file: !1 , line: 3 , type: !19 , isLocal: false , isDefinition: false , scopeLine: 3 , flags: D I F l a g P r o t o t y p e d , isOptimized: false )
!19 = !DISubroutineType ( types: !20 )
!20 = ! { null , !17 , !21 }
!21 = !DIDerivedType ( tag: D W _ T A G _ r e f e r e n c e _ type , baseType: !22 , size: 64 )
!22 = !DIDerivedType ( tag: D W _ T A G _ c o n s t _ type , baseType: !11 )
!23 = !DILocalVariable ( name: "o" , arg: 1 , scope: !7 , file: !1 , line: 6 , type: !11 )
!24 = !DILocation ( line: 6 , column: 16 , scope: !7 )
!25 = !DILocation ( line: 7 , column: 12 , scope: !7 )
!26 = !DILocation ( line: 7 , column: 3 , scope: !7 )