DebugInfo: Fix a bunch of tests that, owing to their compile_unit metadata not including a 13th field, had some subtle behavior.
Without the 13th field, the "emission kind" field defaults to 0 (which
is not equal to either of the values of the emission kind enum (1 ==
full debug info, 2 == line tables only)).
In this particular instance, the comparison with "FullDebugInfo" was
done when adding elements to the ranges list - so for these test cases
no values were added to the ranges list.
This got weirder when emitting debug_loc entries as the addresses should
be relative to the range of the CU if the CU has only one range (the
reasonable assumption is that if we're emitting debug_loc lists for a CU
that CU has at least one range - but due to the above situation, it has
zero) so the ranges were emitted relative to the start of the section
rather than relative to the start of the CU's singular range.
Fix these tests by accounting for the difference in the description of
debug_loc entries (in some cases making the test ignorant to these
differences, in others adding the extra label difference expression,
etc) or the presence/absence of high/low_pc on the CU, and add the 13th
field to their CUs to enable proper "full debug info" emission here.
In a future commit I'll fix up a bunch of other test cases that are not
so rigorously depending on this behavior, but still doing similarly
weird things due to the missing 13th field.
llvm-svn: 214937
2014-08-06 07:57:31 +08:00
; RUN: llc < %s - -filetype=obj | llvm-dwarfdump -debug-dump=loc - | FileCheck %s
2011-05-05 03:00:57 +08:00
; Radar 9376013
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
target triple = "thumbv7-apple-macosx10.6.7"
2014-08-08 06:44:24 +08:00
; Just making sure the first part of the location isn't a repetition
; of the size of the location description.
;
DebugInfo: Fix a bunch of tests that, owing to their compile_unit metadata not including a 13th field, had some subtle behavior.
Without the 13th field, the "emission kind" field defaults to 0 (which
is not equal to either of the values of the emission kind enum (1 ==
full debug info, 2 == line tables only)).
In this particular instance, the comparison with "FullDebugInfo" was
done when adding elements to the ranges list - so for these test cases
no values were added to the ranges list.
This got weirder when emitting debug_loc entries as the addresses should
be relative to the range of the CU if the CU has only one range (the
reasonable assumption is that if we're emitting debug_loc lists for a CU
that CU has at least one range - but due to the above situation, it has
zero) so the ranges were emitted relative to the start of the section
rather than relative to the start of the CU's singular range.
Fix these tests by accounting for the difference in the description of
debug_loc entries (in some cases making the test ignorant to these
differences, in others adding the extra label difference expression,
etc) or the presence/absence of high/low_pc on the CU, and add the 13th
field to their CUs to enable proper "full debug info" emission here.
In a future commit I'll fix up a bunch of other test cases that are not
so rigorously depending on this behavior, but still doing similarly
weird things due to the missing 13th field.
llvm-svn: 214937
2014-08-06 07:57:31 +08:00
; 0x90 DW_OP_regx of super-register
; CHECK: 0x00000000: Beginning address offset:
; CHECK-NEXT: Ending address offset:
2017-03-17 01:14:56 +08:00
; CHECK-NEXT: Location description: 90 {{.. .. $}}
2011-05-05 03:00:57 +08:00
2015-11-06 06:03:56 +08:00
define void @_Z3foov ( ) optsize ssp !dbg !1 {
2011-05-05 03:00:57 +08:00
entry:
%call = tail call float @_Z3barv ( ) optsize , !dbg !11
2017-07-29 04:21:02 +08:00
tail call void @llvm.dbg.value ( metadata float %call , metadata !5 , metadata !DIExpression ( ) ) , !dbg !11
2011-05-05 03:00:57 +08:00
%call16 = tail call float @_Z2f2v ( ) optsize , !dbg !12
%cmp7 = fcmp olt float %call , %call16 , !dbg !12
br i1 %cmp7 , label %for.body , label %for.end , !dbg !12
for.body: ; preds = %entry, %for.body
%k.08 = phi float [ %inc , %for.body ] , [ %call , %entry ]
%call4 = tail call float @_Z2f3f ( float %k.08 ) optsize , !dbg !13
%inc = fadd float %k.08 , 1.000000e+00 , !dbg !14
%call1 = tail call float @_Z2f2v ( ) optsize , !dbg !12
%cmp = fcmp olt float %inc , %call1 , !dbg !12
br i1 %cmp , label %for.body , label %for.end , !dbg !12
for.end: ; preds = %for.body, %entry
ret void , !dbg !15
}
declare float @_Z3barv ( ) optsize
declare float @_Z2f2v ( ) optsize
declare float @_Z2f3f ( float ) optsize
2017-07-29 04:21:02 +08:00
declare void @llvm.dbg.value ( metadata , metadata , metadata ) nounwind readnone
2011-05-05 03:00:57 +08:00
!llvm.dbg.cu = ! { !0 }
2013-11-23 05:49:45 +08:00
!llvm.module.flags = ! { !20 }
2011-05-05 03:00:57 +08:00
2016-04-15 23:57:41 +08:00
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , producer: "clang version 3.0 (trunk 130845)" , isOptimized: true , emissionKind: F u l l D e b u g , file: !18 , enums: !19 , retainedTypes: !19 , imports: null )
!1 = distinct !DISubprogram ( name: "foo" , linkageName: "_Z3foov" , line: 5 , isLocal: false , isDefinition: true , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !0 , scopeLine: 5 , file: !18 , scope: !2 , type: !3 , variables: !17 )
2015-04-30 00:38:44 +08:00
!2 = !DIFile ( filename: "k.cc" , directory: "/private/tmp" )
!3 = !DISubroutineType ( types: !4 )
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
!4 = ! { null }
2015-08-01 02:58:39 +08:00
!5 = !DILocalVariable ( name: "k" , line: 6 , scope: !6 , file: !2 , type: !7 )
2015-04-30 00:38:44 +08:00
!6 = distinct !DILexicalBlock ( line: 5 , column: 12 , file: !18 , scope: !1 )
!7 = !DIBasicType ( tag: D W _ T A G _ b a s e _ type , name: "float" , size: 32 , align: 32 , encoding: D W _ A T E _ float )
2015-08-01 02:58:39 +08:00
!8 = !DILocalVariable ( name: "y" , line: 8 , scope: !9 , file: !2 , type: !7 )
2015-04-30 00:38:44 +08:00
!9 = distinct !DILexicalBlock ( line: 7 , column: 25 , file: !18 , scope: !10 )
!10 = distinct !DILexicalBlock ( line: 7 , column: 3 , file: !18 , scope: !6 )
!11 = !DILocation ( line: 6 , column: 18 , scope: !6 )
!12 = !DILocation ( line: 7 , column: 3 , scope: !6 )
!13 = !DILocation ( line: 8 , column: 20 , scope: !9 )
!14 = !DILocation ( line: 7 , column: 20 , scope: !10 )
!15 = !DILocation ( line: 10 , column: 1 , scope: !6 )
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 = ! { !5 , !8 }
2015-04-30 00:38:44 +08:00
!18 = !DIFile ( filename: "k.cc" , directory: "/private/tmp" )
2015-03-28 04:46:33 +08:00
!19 = ! { }
2015-03-04 01:24:31 +08:00
!20 = ! { i32 1 , !"Debug Info Version" , i32 3 }