[llvm] r214937 - DebugInfo: Fix a bunch of tests that, owing to their compile_unit metadata not including a 13th field, had some subtle behavior.
Adrian Prantl
aprantl at apple.com
Thu Aug 7 12:49:09 PDT 2014
> On Aug 7, 2014, at 12:03 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
> On Thu, Aug 7, 2014 at 11:57 AM, Adrian Prantl <aprantl at apple.com> wrote:
>>
>>> On Aug 5, 2014, at 4:57 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>>
>>> Author: dblaikie
>>> Date: Tue Aug 5 18:57:31 2014
>>> New Revision: 214937
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=214937&view=rev
>>> Log:
>>> 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.
>>>
>>> Modified:
>>> llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll
>>> llvm/trunk/test/CodeGen/ARM/debug-info-sreg2.ll
>>> llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll
>>> llvm/trunk/test/DebugInfo/X86/dbg-value-range.ll
>>>
>>> Modified: llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll?rev=214937&r1=214936&r2=214937&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll (original)
>>> +++ llvm/trunk/test/CodeGen/ARM/2011-08-02-MergedGlobalDbg.ll Tue Aug 5 18:57:31 2014
>>> @@ -1,25 +1,23 @@
>>> -; RUN: llc < %s | FileCheck %s
>>> +; RUN: llc -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
>>>
>>> ; Check debug info output for merged global.
>>> ; DW_AT_location
>>> -; DW_OP_addr
>>> -; DW_OP_plus
>>> -; .long __MergedGlobals
>>> -; DW_OP_constu
>>> -; offset
>>> -
>>> -;CHECK: .long Lset9
>>> -;CHECK-NEXT: @ DW_AT_type
>>> -;CHECK-NEXT: @ DW_AT_decl_file
>>> -;CHECK-NEXT: @ DW_AT_decl_line
>>> -;CHECK-NEXT: @ DW_AT_location
>>> -;CHECK-NEXT: .byte 3
>>> -;CHECK-NEXT: .long __MergedGlobals
>>> -;CHECK-NEXT: .byte 16
>>> -; 4 is byte offset of x2 in __MergedGobals
>>> -;CHECK-NEXT: .byte 4
>>> -;CHECK-NEXT: .byte 34
>>> -
>>> +; 0x03 DW_OP_addr
>>> +; 0x.. .long __MergedGlobals
>>> +; 0x10 DW_OP_constu
>>> +; 0x.. offset
>>> +; 0x22 DW_OP_plus
>>> +
>>> +; CHECK: DW_TAG_variable
>>> +; CHECK-NOT: DW_TAG
>>> +; CHECK: DW_AT_name {{.*}} "x1"
>>> +; CHECK-NOT: {{DW_TAG|NULL}}
>>> +; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x8> 03 [[ADDR:.. .. .. ..]] 10 00 22 )
>>> +; CHECK: DW_TAG_variable
>>> +; CHECK-NOT: DW_TAG
>>> +; CHECK: DW_AT_name {{.*}} "x2"
>>> +; CHECK-NOT: {{DW_TAG|NULL}}
>>> +; CHECK: DW_AT_location [DW_FORM_exprloc] (<0x8> 03 [[ADDR]] 10 04 22 )
>>>
>>> target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32"
>>> target triple = "thumbv7-apple-macosx10.7.0"
>>> @@ -75,7 +73,7 @@ declare void @llvm.dbg.value(metadata, i
>>> !llvm.dbg.cu = !{!0}
>>> !llvm.module.flags = !{!49}
>>>
>>> -!0 = metadata !{i32 786449, metadata !47, i32 12, metadata !"clang", i1 true, metadata !"", i32 0, metadata !48, metadata !48, metadata !40, metadata !41, metadata !48, null} ; [ DW_TAG_compile_unit ]
>>> +!0 = metadata !{i32 786449, metadata !47, i32 12, metadata !"clang", i1 true, metadata !"", i32 0, metadata !48, metadata !48, metadata !40, metadata !41, metadata !48, null, i32 1} ; [ DW_TAG_compile_unit ]
>>> !1 = metadata !{i32 786478, metadata !47, metadata !2, metadata !"get1", metadata !"get1", metadata !"", i32 5, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32 (i32)* @get1, null, null, metadata !42, i32 5} ; [ DW_TAG_subprogram ] [line 5] [def] [get1]
>>> !2 = metadata !{i32 786473, metadata !47} ; [ DW_TAG_file_type ]
>>> !3 = metadata !{i32 786453, metadata !47, metadata !2, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
>>> @@ -97,11 +95,8 @@ declare void @llvm.dbg.value(metadata, i
>>> !19 = metadata !{i32 786689, metadata !8, metadata !"a", metadata !2, i32 16777230, metadata !5, i32 0, null} ; [ DW_TAG_arg_variable ]
>>> !20 = metadata !{i32 786688, metadata !21, metadata !"b", metadata !2, i32 14, metadata !5, i32 0, null} ; [ DW_TAG_auto_variable ]
>>> !21 = metadata !{i32 786443, metadata !47, metadata !8, i32 14, i32 19, i32 3} ; [ DW_TAG_lexical_block ]
>>> -!22 = metadata !{i32 786484, i32 0, metadata !0, metadata !"x5", metadata !"x5", metadata !"", metadata !2, i32 16, metadata !5, i32 0, i32 1, i32* @x5, null} ; [ DW_TAG_variable ]
>>> -!23 = metadata !{i32 786484, i32 0, metadata !0, metadata !"x4", metadata !"x4", metadata !"", metadata !2, i32 13, metadata !5, i32 1, i32 1, i32* @x4, null} ; [ DW_TAG_variable ]
>>> -!24 = metadata !{i32 786484, i32 0, metadata !0, metadata !"x3", metadata !"x3", metadata !"", metadata !2, i32 10, metadata !5, i32 1, i32 1, i32* @x3, null} ; [ DW_TAG_variable ]
>>> -!25 = metadata !{i32 786484, i32 0, metadata !0, metadata !"x2", metadata !"x2", metadata !"", metadata !2, i32 7, metadata !5, i32 1, i32 1, i32* @x2, null} ; [ DW_TAG_variable ]
>>> -!26 = metadata !{i32 786484, i32 0, metadata !0, metadata !"x1", metadata !"x1", metadata !"", metadata !2, i32 4, metadata !5, i32 1, i32 1, i32* @x1, null} ; [ DW_TAG_variable ]
>>> +!25 = metadata !{i32 786484, i32 0, metadata !0, metadata !"x1", metadata !"x1", metadata !"", metadata !2, i32 4, metadata !5, i32 1, i32 1, i32* @x1, null} ; [ DW_TAG_variable ]
>>> +!26 = metadata !{i32 786484, i32 0, metadata !0, metadata !"x2", metadata !"x2", metadata !"", metadata !2, i32 7, metadata !5, i32 1, i32 1, i32* @x2, null} ; [ DW_TAG_variable ]
>>> !27 = metadata !{i32 786689, metadata !9, metadata !"a", metadata !2, i32 16777233, metadata !5, i32 0, null} ; [ DW_TAG_arg_variable ]
>>> !28 = metadata !{i32 786688, metadata !29, metadata !"b", metadata !2, i32 17, metadata !5, i32 0, null} ; [ DW_TAG_auto_variable ]
>>> !29 = metadata !{i32 786443, metadata !47, metadata !9, i32 17, i32 19, i32 4} ; [ DW_TAG_lexical_block ]
>>> @@ -116,7 +111,7 @@ declare void @llvm.dbg.value(metadata, i
>>> !38 = metadata !{i32 17, i32 16, metadata !9, null}
>>> !39 = metadata !{i32 17, i32 32, metadata !29, null}
>>> !40 = metadata !{metadata !1, metadata !6, metadata !7, metadata !8, metadata !9}
>>> -!41 = metadata !{metadata !22, metadata !23, metadata !24, metadata !25, metadata !26}
>>> +!41 = metadata !{metadata !25, metadata !26}
>>> !42 = metadata !{metadata !10, metadata !11}
>>> !43 = metadata !{metadata !13, metadata !14}
>>> !44 = metadata !{metadata !16, metadata !17}
>>>
>>> Modified: llvm/trunk/test/CodeGen/ARM/debug-info-sreg2.ll
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/debug-info-sreg2.ll?rev=214937&r1=214936&r2=214937&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/test/CodeGen/ARM/debug-info-sreg2.ll (original)
>>> +++ llvm/trunk/test/CodeGen/ARM/debug-info-sreg2.ll Tue Aug 5 18:57:31 2014
>>> @@ -1,21 +1,14 @@
>>> -; RUN: llc < %s - | FileCheck %s
>>> +; RUN: llc < %s - -filetype=obj | llvm-dwarfdump -debug-dump=loc - | FileCheck %s
>>> ; 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"
>>>
>>> -;CHECK-LABEL: Lfunc_begin0:
>>> -;CHECK: Ltmp[[K:[0-9]+]]:
>>> -;CHECK: Ltmp[[L:[0-9]+]]:
>>> -;CHECK-LABEL: Ldebug_loc0:
>>> -;CHECK-NEXT: .long Ltmp[[K]]
>>> -;CHECK-NEXT: .long Ltmp[[L]]
>>> -;CHECK-NEXT: Lset[[N:[0-9]+]] = Ltmp{{[0-9]+}}-Ltmp[[M:[0-9]+]] @ Loc expr size
>>> -;CHECK-NEXT: .short Lset[[N]]
>>> -;CHECK-NEXT: Ltmp[[M]]:
>>> -;CHECK-NEXT: .byte 144 @ super-register
>>> -;CHECK-NEXT: @ DW_OP_regx
>>> -;CHECK-NEXT: .ascii
>>> -;CHECK-NEXT: .byte {{[0-9]+}} @ DW_OP_{{.*}}piece
>>
>>> +; Just making sure the first part of the location isn't a repetition of the size of the location description.
>>> +; 0x90 DW_OP_regx of super-register
>>> +
>>> +; CHECK: 0x00000000: Beginning address offset:
>>> +; CHECK-NEXT: Ending address offset:
>>> +; CHECK-NEXT: Location description: 90 {{.. .. .. ..}}
>> Could you please add the opcode for DW_OP_(bit)_piece, too? Something like "9[3d]" should be equivalent to the check removed above.
>
> That doesn't/didn't look like what this test was intended to test
> originally. I see you updated it in r202416, mentioning that the test
> changes were needed due to changes in the annotation comment text -
> but in doing so you further constrained this test to test for
> something other than what it seems to be intended to test.
>
> To reduce test churn in the future, I wanted to make the test only
> test what was intended (so we don't have to go back and modify it as
> often when unrelated changes modify the output in ways that the test
> doesn't care about). Is there a reason to have it testing something
> else?
Actually from looking at rdar://9376013 (which obviously you can’t see) the test is intended to test the correct DWARF for a value in an ARM S register, which is represented via a piece operation of a super-register. I will update the comment in the testcase.
I know we have a lot of legacy testcases that have no comments in them. Whenever I come across one I usually try to fill in the information from the radar and comment what the test is supposed to be testing. Apparently I forgot to do that when I was updating this testcase, sorry!
I think making each testcase test only one feature is reasonable. But when rewriting an existing testcase with that intention, we should split it up into two tests that are both commented instead of just dropping one of them.
In this particular case, I think it makes more sense to just test for the correctness of the entire DWARF expression and describe this in the comment.
Adrian
>
> - David
>
>>
>> thanks,
>> adrian
>>
>>>
>>> define void @_Z3foov() optsize ssp {
>>> entry:
>>> @@ -48,7 +41,7 @@ declare void @llvm.dbg.value(metadata, i
>>> !llvm.dbg.cu = !{!0}
>>> !llvm.module.flags = !{!20}
>>>
>>> -!0 = metadata !{i32 786449, metadata !18, i32 4, metadata !"clang version 3.0 (trunk 130845)", i1 true, metadata !"", i32 0, metadata !19, metadata !19, metadata !16, null, null, null} ; [ DW_TAG_compile_unit ]
>>> +!0 = metadata !{i32 786449, metadata !18, i32 4, metadata !"clang version 3.0 (trunk 130845)", i1 true, metadata !"", i32 0, metadata !19, metadata !19, metadata !16, null, null, null, i32 1} ; [ DW_TAG_compile_unit ]
>>> !1 = metadata !{i32 786478, metadata !18, metadata !2, metadata !"foo", metadata !"foo", metadata !"_Z3foov", i32 5, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, void ()* @_Z3foov, null, null, metadata !17, i32 5} ; [ DW_TAG_subprogram ] [line 5] [def] [foo]
>>> !2 = metadata !{i32 786473, metadata !18} ; [ DW_TAG_file_type ]
>>> !3 = metadata !{i32 786453, metadata !18, metadata !2, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
>>>
>>> Modified: llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll?rev=214937&r1=214936&r2=214937&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll (original)
>>> +++ llvm/trunk/test/CodeGen/X86/2010-05-26-DotDebugLoc.ll Tue Aug 5 18:57:31 2014
>>> @@ -26,7 +26,7 @@ declare void @llvm.dbg.value(metadata, i
>>>
>>> !0 = metadata !{i32 786484, i32 0, metadata !1, metadata !"ret", metadata !"ret", metadata !"", metadata !1, i32 7, metadata !3, i1 false, i1 true, null, null} ; [ DW_TAG_variable ]
>>> !1 = metadata !{i32 786473, metadata !36} ; [ DW_TAG_file_type ]
>>> -!2 = metadata !{i32 786449, metadata !36, i32 1, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, metadata !"", i32 0, metadata !37, metadata !37, metadata !32, metadata !31, metadata !37, metadata !""} ; [ DW_TAG_compile_unit ]
>>> +!2 = metadata !{i32 786449, metadata !36, i32 1, metadata !"4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", i1 true, metadata !"", i32 0, metadata !37, metadata !37, metadata !32, metadata !31, metadata !37, metadata !"", i32 1} ; [ DW_TAG_compile_unit ]
>>> !3 = metadata !{i32 786468, metadata !36, metadata !1, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
>>> !4 = metadata !{i32 786689, metadata !5, metadata !"x", metadata !1, i32 12, metadata !3, i32 0, null} ; [ DW_TAG_arg_variable ]
>>> !5 = metadata !{i32 786478, metadata !36, metadata !1, metadata !"foo", metadata !"foo", metadata !"foo", i32 13, metadata !6, i1 false, i1 true, i32 0, i32 0, null, i1 false, i1 true, void (i32)* @foo, null, null, metadata !33, i32 13} ; [ DW_TAG_subprogram ]
>>> @@ -73,15 +73,19 @@ declare void @llvm.dbg.value(metadata, i
>>>
>>>
>>> ; CHECK: Ldebug_loc0:
>>> -; CHECK-NEXT: .quad Lfunc_begin0
>>> -; CHECK-NEXT: .quad [[LABEL]]
>>> +; CHECK-NEXT: [[SET1:.*]] = Lfunc_begin0-Lfunc_begin0
>>> +; CHECK-NEXT: .quad [[SET1]]
>>> +; CHECK-NEXT: [[SET2:.*]] = [[LABEL]]-Lfunc_begin0
>>> +; CHECK-NEXT: .quad [[SET2]]
>>> ; CHECK-NEXT: Lset{{.*}} = Ltmp{{.*}}-Ltmp{{.*}} ## Loc expr size
>>> ; CHECK-NEXT: .short Lset{{.*}}
>>> ; CHECK-NEXT: Ltmp{{.*}}:
>>> ; CHECK-NEXT: .byte 85
>>> ; CHECK-NEXT: Ltmp{{.*}}:
>>> -; CHECK-NEXT: .quad [[LABEL]]
>>> -; CHECK-NEXT: .quad [[CLOBBER]]
>>> +; CHECK-NEXT: [[SET3:.*]] = [[LABEL]]-Lfunc_begin0
>>> +; CHECK-NEXT: .quad [[SET3]]
>>> +; CHECK-NEXT: [[SET4:.*]] = [[CLOBBER]]-Lfunc_begin0
>>> +; CHECK-NEXT: .quad [[SET4]]
>>> ; CHECK-NEXT: Lset{{.*}} = Ltmp{{.*}}-Ltmp{{.*}} ## Loc expr size
>>> ; CHECK-NEXT: .short Lset{{.*}}
>>> ; CHECK-NEXT: Ltmp{{.*}}:
>>>
>>> Modified: llvm/trunk/test/DebugInfo/X86/dbg-value-range.ll
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dbg-value-range.ll?rev=214937&r1=214936&r2=214937&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/test/DebugInfo/X86/dbg-value-range.ll (original)
>>> +++ llvm/trunk/test/DebugInfo/X86/dbg-value-range.ll Tue Aug 5 18:57:31 2014
>>> @@ -22,7 +22,7 @@ declare void @llvm.dbg.value(metadata, i
>>>
>>> !0 = metadata !{i32 786478, metadata !22, metadata !1, metadata !"bar", metadata !"bar", metadata !"", i32 5, metadata !3, i1 false, i1 true, i32 0, i32 0, null, i32 256, i1 true, i32 (%struct.a*)* @bar, null, null, metadata !21, i32 0} ; [ DW_TAG_subprogram ] [line 5] [def] [scope 0] [bar]
>>> !1 = metadata !{i32 786473, metadata !22} ; [ DW_TAG_file_type ]
>>> -!2 = metadata !{i32 786449, metadata !22, i32 12, metadata !"clang version 2.9 (trunk 122997)", i1 true, metadata !"", i32 0, metadata !23, metadata !23, metadata !20, null, null, null} ; [ DW_TAG_compile_unit ]
>>> +!2 = metadata !{i32 786449, metadata !22, i32 12, metadata !"clang version 2.9 (trunk 122997)", i1 true, metadata !"", i32 0, metadata !23, metadata !23, metadata !20, null, null, null, i32 1} ; [ DW_TAG_compile_unit ]
>>> !3 = metadata !{i32 786453, metadata !22, metadata !1, metadata !"", i32 0, i64 0, i64 0, i32 0, i32 0, null, metadata !4, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
>>> !4 = metadata !{metadata !5}
>>> !5 = metadata !{i32 786468, null, metadata !2, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ]
>>> @@ -51,8 +51,10 @@ declare void @llvm.dbg.value(metadata, i
>>> ;CHECK-NEXT: [[CLOBBER:Ltmp[0-9]*]]
>>>
>>> ;CHECK:Ldebug_loc0:
>>> +;CHECK-NEXT: Lset{{.*}} =
>>> ;CHECK-NEXT: .quad
>>> -;CHECK-NEXT: .quad [[CLOBBER]]
>>> +;CHECK-NEXT: [[CLOBBER_OFF:Lset.*]] = [[CLOBBER]]-{{.*}}
>>> +;CHECK-NEXT: .quad [[CLOBBER_OFF]]
>>> ;CHECK-NEXT: Lset{{.*}} = Ltmp{{.*}}-Ltmp{{.*}}
>>> ;CHECK-NEXT: .short Lset
>>> ;CHECK-NEXT: Ltmp
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
More information about the llvm-commits
mailing list