2019-12-12 23:51:18 +08:00
; RUN: llc -mtriple=arm-apple-darwin -O0 -o - %s | FileCheck %s
2011-04-28 10:22:40 +08:00
; Use DW_OP_breg in variable's location expression if the variable is in a stack slot.
2010-08-05 02:42:46 +08:00
2019-12-12 23:51:18 +08:00
; CHECK: @ DW_OP_breg
2016-01-15 08:46:17 +08:00
2010-08-05 02:42:46 +08:00
%struct.SVal = type { i8 * , i32 }
2019-12-12 23:51:18 +08:00
define i32 @_Z3fooi4SVal ( i32 %i , %struct.SVal * noalias %location ) #0 !dbg !4 {
2010-08-05 02:42:46 +08:00
entry:
2016-12-28 02:35:19 +08:00
%"alloca point" = bitcast i32 0 to i32
2019-12-12 23:51:18 +08:00
call void @llvm.dbg.value ( metadata i32 %i , metadata !21 , metadata !DIExpression ( ) ) , !dbg !22
call void @llvm.dbg.value ( metadata %struct.SVal * %location , metadata !23 , metadata !DIExpression ( ) ) , !dbg !22
%tmp = icmp ne i32 %i , 0 , !dbg !25
br i1 %tmp , label %bb , label %bb1 , !dbg !25
bb: ; preds = %entry
%tmp1 = getelementptr inbounds %struct.SVal , %struct.SVal * %location , i32 0 , i32 1 , !dbg !27
%tmp2 = load i32 , i32 * %tmp1 , align 8 , !dbg !27
%tmp3 = add i32 %tmp2 , %i , !dbg !27
br label %bb2 , !dbg !27
bb1: ; preds = %entry
%tmp4 = getelementptr inbounds %struct.SVal , %struct.SVal * %location , i32 0 , i32 1 , !dbg !28
%tmp5 = load i32 , i32 * %tmp4 , align 8 , !dbg !28
%tmp6 = sub i32 %tmp5 , 1 , !dbg !28
br label %bb2 , !dbg !28
bb2: ; preds = %bb1, %bb
%.0 = phi i32 [ %tmp3 , %bb ] , [ %tmp6 , %bb1 ]
br label %return , !dbg !27
return: ; preds = %bb2
ret i32 %.0 , !dbg !27
2010-08-05 02:42:46 +08:00
}
2019-12-12 23:51:18 +08:00
declare void @llvm.dbg.declare ( metadata , metadata , metadata ) #1
declare void @llvm.dbg.value ( metadata , metadata , metadata ) #1
attributes #0 = { nounwind ssp }
attributes #1 = { nounwind readnone s p e c u l a t a b l e w i l l r e t u r n }
!llvm.dbg.cu = ! { !0 }
!llvm.module.flags = ! { !3 }
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , file: !1 , producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)" , isOptimized: false , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !2 , retainedTypes: !2 , globals: !2 , imports: !2 )
!1 = !DIFile ( filename: "small.cc" , directory: "/Users/manav/R8248330" )
!2 = ! { }
!3 = ! { i32 1 , !"Debug Info Version" , i32 3 }
!4 = distinct !DISubprogram ( name: "foo" , linkageName: "_Z3fooi4SVal" , scope: !1 , file: !1 , line: 16 , type: !5 , virtualIndex: 6 , spFlags: D I S P F l a g D e f i n i t i o n , unit: !0 )
!5 = !DISubroutineType ( types: !6 )
!6 = ! { !7 , !7 , !8 }
!7 = !DIBasicType ( name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
!8 = !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , name: "SVal" , file: !1 , line: 1 , size: 64 , align: 64 , elements: !9 )
!9 = ! { !10 , !12 , !14 , !18 }
!10 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "Data" , scope: !8 , file: !1 , line: 7 , baseType: !11 , size: 64 , align: 64 )
!11 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , file: !1 , baseType: null , size: 64 , align: 64 )
!12 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "Kind" , scope: !8 , file: !1 , line: 8 , baseType: !13 , size: 32 , align: 32 , offset: 64 )
!13 = !DIBasicType ( name: "unsigned int" , size: 32 , align: 32 , encoding: D W _ A T E _ u n s i g n e d )
!14 = !DISubprogram ( name: "SVal" , scope: !8 , file: !1 , line: 11 , type: !15 , virtualIndex: 6 , spFlags: 0 )
!15 = !DISubroutineType ( types: !16 )
!16 = ! { null , !17 }
!17 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , file: !1 , baseType: !8 , size: 64 , align: 64 , flags: D I F l a g A r t i f i c i a l )
!18 = !DISubprogram ( name: "~SVal" , scope: !8 , file: !1 , line: 12 , type: !19 , virtualIndex: 6 , spFlags: 0 )
!19 = !DISubroutineType ( types: !20 )
!20 = ! { null , !17 , !7 }
!21 = !DILocalVariable ( name: "i" , arg: 1 , scope: !4 , file: !1 , line: 16 , type: !7 )
!22 = !DILocation ( line: 16 , scope: !4 )
!23 = !DILocalVariable ( name: "location" , arg: 2 , scope: !4 , file: !1 , line: 16 , type: !24 )
!24 = !DIDerivedType ( tag: D W _ T A G _ r e f e r e n c e _ type , name: "SVal" , scope: !1 , file: !1 , baseType: !8 , size: 32 , align: 32 )
!25 = !DILocation ( line: 17 , scope: !26 )
!26 = distinct !DILexicalBlock ( scope: !4 , file: !1 , line: 16 )
!27 = !DILocation ( line: 18 , scope: !26 )
!28 = !DILocation ( line: 20 , scope: !26 )