2013-07-24 23:55:41 +08:00
; RUN: llc -O2 < %s | FileCheck %s
; RUN: llc -O2 -regalloc=basic < %s | FileCheck %s
2016-12-22 08:45:21 +08:00
source_filename = "test/CodeGen/X86/2010-05-26-DotDebugLoc.ll"
2010-05-27 04:18:50 +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"
2011-04-20 04:46:13 +08:00
target triple = "x86_64-apple-darwin10"
2010-05-27 04:18:50 +08:00
%struct.a = type { i32 , %struct.a * }
2016-12-22 08:45:21 +08:00
@llvm.used = appending global [ 1 x i8 * ] [ i8 * bitcast ( i8 * ( %struct.a * ) * @bar to i8 * ) ] , section "llvm.metadata"
2010-05-27 04:18:50 +08:00
2016-12-22 08:45:21 +08:00
; Function Attrs: noinline nounwind optsize ssp
define i8 * @bar ( %struct.a * %myvar ) #0 !dbg !8 {
2010-05-27 04:18:50 +08:00
entry:
2016-12-22 08:45:21 +08:00
tail call void @llvm.dbg.value ( metadata %struct.a * %myvar , i64 0 , metadata !18 , metadata !19 ) , !dbg !20
%0 = getelementptr inbounds %struct.a , %struct.a * %myvar , i64 0 , i32 0 , !dbg !21
%1 = load i32 , i32 * %0 , align 8 , !dbg !21
tail call void @foo ( i32 %1 ) #0 , !dbg !21
%2 = bitcast %struct.a * %myvar to i8 * , !dbg !23
ret i8 * %2 , !dbg !23
2010-05-27 04:18:50 +08:00
}
2016-12-22 08:45:21 +08:00
; Function Attrs: noinline nounwind optsize ssp
declare void @foo ( i32 ) #0
2010-05-27 04:18:50 +08:00
2016-12-22 08:45:21 +08:00
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value ( metadata , i64 , metadata , metadata ) #1
2010-05-27 04:18:50 +08:00
2016-12-22 08:45:21 +08:00
attributes #0 = { noinline nounwind optsize ssp }
attributes #1 = { nounwind readnone }
2010-05-27 04:18:50 +08:00
2016-12-22 08:45:21 +08:00
!llvm.dbg.cu = ! { !0 }
!llvm.module.flags = ! { !7 }
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C 89 , file: !1 , 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: !2 , retainedTypes: !2 , globals: !3 , imports: !2 )
2015-04-30 00:38:44 +08:00
!1 = !DIFile ( filename: "foo.c" , directory: "/tmp/" )
2016-12-22 08:45:21 +08:00
!2 = ! { }
!3 = ! { !4 }
2017-08-31 02:06:51 +08:00
!4 = !DIGlobalVariableExpression ( var: !5 , expr: !DIExpression ( ) )
2016-12-22 08:45:21 +08:00
!5 = !DIGlobalVariable ( name: "ret" , scope: !1 , file: !1 , line: 7 , type: !6 , isLocal: false , isDefinition: true )
!6 = !DIBasicType ( name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
!7 = ! { i32 1 , !"Debug Info Version" , i32 3 }
!8 = distinct !DISubprogram ( name: "bar" , linkageName: "bar" , scope: !1 , file: !1 , line: 17 , type: !9 , isLocal: false , isDefinition: true , scopeLine: 17 , virtualIndex: 6 , isOptimized: true , unit: !0 , variables: !17 )
!9 = !DISubroutineType ( types: !10 )
!10 = ! { !11 , !12 }
!11 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , scope: !1 , file: !1 , baseType: null , size: 64 , align: 64 )
!12 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , scope: !1 , file: !1 , baseType: !13 , size: 64 , align: 64 )
!13 = !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , name: "a" , scope: !1 , file: !1 , line: 2 , size: 128 , align: 64 , elements: !14 )
!14 = ! { !15 , !16 }
!15 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "c" , scope: !13 , file: !1 , line: 3 , baseType: !6 , size: 32 , align: 32 )
!16 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "d" , scope: !13 , file: !1 , line: 4 , baseType: !12 , size: 64 , align: 64 , offset: 64 )
!17 = ! { !18 }
!18 = !DILocalVariable ( name: "myvar" , arg: 1 , scope: !8 , file: !1 , line: 17 , type: !12 )
!19 = !DIExpression ( )
!20 = !DILocation ( line: 0 , scope: !8 )
!21 = !DILocation ( line: 18 , scope: !22 )
!22 = distinct !DILexicalBlock ( scope: !8 , file: !1 , line: 17 )
!23 = !DILocation ( line: 19 , scope: !22 )
2010-05-27 04:18:50 +08:00
2011-03-26 01:20:59 +08:00
; The variable bar:myvar changes registers after the first movq.
; It is cobbered by popq %rbx
; CHECK: movq
; CHECK-NEXT: [[LABEL:Ltmp[0-9]*]]
; CHECK: .loc 1 19 0
; CHECK: popq
; CHECK-NEXT: [[CLOBBER:Ltmp[0-9]*]]
2010-05-27 07:55:23 +08:00
; CHECK: Ldebug_loc0:
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
; CHECK-NEXT: [[SET1:.*]] = Lfunc_begin0-Lfunc_begin0
; CHECK-NEXT: .quad [[SET1]]
; CHECK-NEXT: [[SET2:.*]] = [[LABEL]]-Lfunc_begin0
; CHECK-NEXT: .quad [[SET2]]
2015-05-07 03:11:20 +08:00
; CHECK-NEXT: .short 1 ## Loc expr size
2010-05-27 04:18:50 +08:00
; CHECK-NEXT: .byte 85
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
; CHECK-NEXT: [[SET3:.*]] = [[LABEL]]-Lfunc_begin0
; CHECK-NEXT: .quad [[SET3]]
; CHECK-NEXT: [[SET4:.*]] = [[CLOBBER]]-Lfunc_begin0
; CHECK-NEXT: .quad [[SET4]]
2015-05-07 03:11:20 +08:00
; CHECK-NEXT: .short 1 ## Loc expr size
2010-05-27 04:18:50 +08:00
; CHECK-NEXT: .byte 83