2013-08-23 08:23:24 +08:00
; RUN: opt -strip-dead-debug-info -verify %s -S | FileCheck %s
2013-08-29 08:41:22 +08:00
; CHECK: ModuleID = '{{.*}}'
2016-06-17 03:39:55 +08:00
; CHECK-NOT: "bar"
; CHECK-NOT: "abcd"
2017-04-07 03:26:22 +08:00
; CHECK-NOT: "GCC"
; CHECK: "Globals"
; CHECK: "abcd2"
2013-08-23 08:23:24 +08:00
2016-12-22 08:45:21 +08:00
source_filename = "test/Transforms/StripSymbols/strip-dead-debug-info.ll"
@xyz = global i32 2 , !dbg !0
2013-08-23 08:23:24 +08:00
; Function Attrs: nounwind readnone
2017-07-29 04:21:02 +08:00
declare void @llvm.dbg.value ( metadata , metadata , metadata ) #0
2013-08-23 08:23:24 +08:00
; Function Attrs: nounwind readnone ssp
2016-12-22 08:45:21 +08:00
define i32 @fn ( ) #1 !dbg !10 {
2013-08-23 08:23:24 +08:00
entry:
2016-12-22 08:45:21 +08:00
ret i32 0 , !dbg !13
2013-08-23 08:23:24 +08:00
}
; Function Attrs: nounwind readonly ssp
2016-12-22 08:45:21 +08:00
define i32 @foo ( i32 %i ) #2 !dbg !15 {
2013-08-23 08:23:24 +08:00
entry:
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i32 %i , metadata !18 , metadata !19 ) , !dbg !20
2017-04-11 21:32:11 +08:00
%.0 = load i32 , i32 * @xyz , align 4 , !dbg !30
2013-08-23 08:23:24 +08:00
ret i32 %.0 , !dbg !21
}
attributes #0 = { nounwind readnone }
attributes #1 = { nounwind readnone ssp }
attributes #2 = { nounwind readonly ssp }
2017-04-11 21:32:11 +08:00
!llvm.dbg.cu = ! { !4 , !23 , !24 , !28 }
2016-12-22 08:45:21 +08:00
!llvm.module.flags = ! { !9 }
2017-08-31 02:06:51 +08:00
!0 = !DIGlobalVariableExpression ( var: !1 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!1 = !DIGlobalVariable ( name: "xyz" , scope: !2 , file: !2 , line: 3 , type: !3 , isLocal: false , isDefinition: true )
!2 = !DIFile ( filename: "g.c" , directory: "/tmp/" )
!3 = !DIBasicType ( name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
!4 = distinct !DICompileUnit ( language: D W _ L A N G _ C 89 , file: !2 , producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !5 , retainedTypes: !5 , globals: !6 )
!5 = ! { }
!6 = ! { !7 , !0 }
2017-08-31 02:06:51 +08:00
!7 = !DIGlobalVariableExpression ( var: !8 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!8 = !DIGlobalVariable ( name: "abcd" , scope: !2 , file: !2 , line: 2 , type: !3 , isLocal: true , isDefinition: true )
!9 = ! { i32 1 , !"Debug Info Version" , i32 3 }
!10 = distinct !DISubprogram ( name: "fn" , linkageName: "fn" , scope: null , file: !2 , line: 6 , type: !11 , isLocal: false , isDefinition: true , virtualIndex: 6 , isOptimized: true , unit: !4 )
2015-04-30 00:38:44 +08:00
!11 = !DISubroutineType ( types: !12 )
2016-12-22 08:45:21 +08:00
!12 = ! { !3 }
!13 = !DILocation ( line: 6 , scope: !14 )
!14 = distinct !DILexicalBlock ( scope: !10 , file: !2 , line: 6 )
!15 = distinct !DISubprogram ( name: "foo" , linkageName: "foo" , scope: null , file: !2 , line: 7 , type: !16 , isLocal: false , isDefinition: true , virtualIndex: 6 , isOptimized: true , unit: !4 )
!16 = !DISubroutineType ( types: !17 )
!17 = ! { !3 , !3 }
!18 = !DILocalVariable ( name: "i" , arg: 1 , scope: !15 , file: !2 , line: 7 , type: !3 )
!19 = !DIExpression ( )
!20 = !DILocation ( line: 7 , scope: !15 )
2015-04-30 00:38:44 +08:00
!21 = !DILocation ( line: 10 , scope: !22 )
2016-12-22 08:45:21 +08:00
!22 = distinct !DILexicalBlock ( scope: !15 , file: !2 , line: 7 )
2017-04-07 03:26:22 +08:00
!23 = distinct !DICompileUnit ( language: D W _ L A N G _ C 89 , file: !2 , producer: "GCC" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !5 , retainedTypes: !5 , globals: !5 )
!24 = distinct !DICompileUnit ( language: D W _ L A N G _ C 89 , file: !2 , producer: "Globals" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !5 , retainedTypes: !5 , globals: !25 )
!25 = ! { !26 }
!26 = !DIGlobalVariableExpression ( var: !27 , expr: !DIExpression ( D W _ O P _ c o n s t u , 0 , D W _ O P _ s t a c k _ v a l u e ) )
!27 = !DIGlobalVariable ( name: "abcd2" , scope: !2 , file: !2 , line: 2 , type: !3 , isLocal: true , isDefinition: true )
2017-04-11 21:32:11 +08:00
!28 = distinct !DICompileUnit ( language: D W _ L A N G _ C 89 , file: !2 , producer: "InlineTest" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !5 , retainedTypes: !5 , globals: !5 )
!29 = distinct !DISubprogram ( name: "inlinefunc" , linkageName: "inlinefunc" , scope: null , file: !2 , line: 7 , type: !16 , isLocal: false , isDefinition: true , isOptimized: true , unit: !28 )
!30 = !DILocation ( line: 100 , scope: !29 , inlinedAt: !21 )