2014-02-14 09:26:55 +08:00
; RUN: llc -generate-arange-section < %s | FileCheck %s
2013-10-03 16:54:43 +08:00
; CHECK: .short 2 # DWARF Arange version number
; CHECK: # Segment Size
; CHECK-NOT: debug_loc
; CHECK: .quad global
; CHECK-NOT: debug_loc
; CHECK: # ARange terminator
; --- Source code ---
; Generated with "clang -g -O1 -S -emit-llvm"
; int global = 2;
; int foo(int bar) { return bar; }
; int foo2(int bar2) { return bar2; }
; int main() {
; return foo(2) + foo2(1) + global;
; }
; ModuleID = 'tmp/debug_ranges/a.cc'
2016-12-22 08:45:21 +08:00
source_filename = "test/DebugInfo/X86/dwarf-aranges-no-dwarf-labels.ll"
2013-10-03 16:54:43 +08:00
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
2016-12-22 08:45:21 +08:00
@global = global i32 2 , align 4 , !dbg !0
2013-10-03 16:54:43 +08:00
; Function Attrs: nounwind readnone uwtable
2016-12-22 08:45:21 +08:00
define i32 @_Z3fooi ( i32 %bar ) #0 !dbg !9 {
2013-10-03 16:54:43 +08:00
entry:
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i32 %bar , metadata !13 , metadata !14 ) , !dbg !15
2016-12-22 08:45:21 +08:00
ret i32 %bar , !dbg !15
2013-10-03 16:54:43 +08:00
}
; Function Attrs: nounwind readnone uwtable
2016-12-22 08:45:21 +08:00
define i32 @_Z4foo2i ( i32 %bar2 ) #0 !dbg !16 {
2013-10-03 16:54:43 +08:00
entry:
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata i32 %bar2 , metadata !18 , metadata !14 ) , !dbg !19
2016-12-22 08:45:21 +08:00
ret i32 %bar2 , !dbg !19
2013-10-03 16:54:43 +08:00
}
; Function Attrs: nounwind readonly uwtable
2016-12-22 08:45:21 +08:00
define i32 @main ( ) #1 !dbg !20 {
2013-10-03 16:54:43 +08:00
entry:
2016-12-22 08:45:21 +08:00
%call = tail call i32 @_Z3fooi ( i32 2 ) , !dbg !23
%call1 = tail call i32 @_Z4foo2i ( i32 1 ) , !dbg !23
%add = add nsw i32 %call1 , %call , !dbg !23
%0 = load i32 , i32 * @global , align 4 , !dbg !23 , !tbaa !24
%add2 = add nsw i32 %add , %0 , !dbg !23
ret i32 %add2 , !dbg !23
2013-10-03 16:54:43 +08:00
}
; Function Attrs: nounwind readnone
2017-07-29 04:21:02 +08:00
declare void @llvm.dbg.value ( metadata , metadata , metadata ) #2
2013-10-03 16:54:43 +08:00
attributes #0 = { nounwind readnone uwtable "less-precise-fpmad" = "false" "no-frame-pointer-elim" = "false" "no-infs-fp-math" = "false" "no-nans-fp-math" = "false" "stack-protector-buffer-size" = "8" "unsafe-fp-math" = "false" "use-soft-float" = "false" }
attributes #1 = { nounwind readonly uwtable "less-precise-fpmad" = "false" "no-frame-pointer-elim" = "false" "no-infs-fp-math" = "false" "no-nans-fp-math" = "false" "stack-protector-buffer-size" = "8" "unsafe-fp-math" = "false" "use-soft-float" = "false" }
attributes #2 = { nounwind readnone }
2016-12-22 08:45:21 +08:00
!llvm.dbg.cu = ! { !4 }
!llvm.module.flags = ! { !7 , !8 }
2013-10-03 16:54:43 +08:00
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: "global" , scope: null , file: !2 , line: 1 , type: !3 , isLocal: false , isDefinition: true )
!2 = !DIFile ( filename: "tmp/debug_ranges/a.cc" , directory: "/" )
!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 _ p l u s _ p l u s , file: !2 , producer: "clang version 3.4 (191881)" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !5 , retainedTypes: !5 , globals: !6 , imports: !5 )
!5 = ! { }
!6 = ! { !0 }
!7 = ! { i32 2 , !"Dwarf Version" , i32 4 }
!8 = ! { i32 1 , !"Debug Info Version" , i32 3 }
!9 = distinct !DISubprogram ( name: "foo" , linkageName: "_Z3fooi" , scope: !2 , file: !2 , line: 2 , type: !10 , isLocal: false , isDefinition: true , scopeLine: 2 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !4 , variables: !12 )
!10 = !DISubroutineType ( types: !11 )
!11 = ! { !3 , !3 }
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
!12 = ! { !13 }
2016-12-22 08:45:21 +08:00
!13 = !DILocalVariable ( name: "bar" , arg: 1 , scope: !9 , file: !2 , line: 2 , type: !3 )
!14 = !DIExpression ( )
!15 = !DILocation ( line: 2 , scope: !9 )
!16 = distinct !DISubprogram ( name: "foo2" , linkageName: "_Z4foo2i" , scope: !2 , file: !2 , line: 3 , type: !10 , isLocal: false , isDefinition: true , scopeLine: 3 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !4 , variables: !17 )
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
!17 = ! { !18 }
2016-12-22 08:45:21 +08:00
!18 = !DILocalVariable ( name: "bar2" , arg: 1 , scope: !16 , file: !2 , line: 3 , type: !3 )
!19 = !DILocation ( line: 3 , scope: !16 )
!20 = distinct !DISubprogram ( name: "main" , scope: !2 , file: !2 , line: 5 , type: !21 , isLocal: false , isDefinition: true , scopeLine: 5 , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !4 , variables: !5 )
!21 = !DISubroutineType ( types: !22 )
!22 = ! { !3 }
!23 = !DILocation ( line: 6 , scope: !20 )
!24 = ! { !25 , !25 , i64 0 }
!25 = ! { !"int" , !26 }
!26 = ! { !"omnipotent char" , !27 }
!27 = ! { !"Simple C/C++ TBAA" }