xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/2010-08-04-StackVariable.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 -mtriple=arm-apple-darwin < %s | grep DW_OP_breg
2*9880d681SAndroid Build Coastguard Worker; Use DW_OP_breg in variable's location expression if the variable is in a stack slot.
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64"
5*9880d681SAndroid Build Coastguard Workertarget triple = "arm-apple-darwin"
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker%struct.SVal = type { i8*, i32 }
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdefine i32 @_Z3fooi4SVal(i32 %i, %struct.SVal* noalias %location) nounwind ssp !dbg !17 {
10*9880d681SAndroid Build Coastguard Workerentry:
11*9880d681SAndroid Build Coastguard Worker  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
12*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !23, metadata !DIExpression()), !dbg !24
13*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.value(metadata %struct.SVal* %location, i64 0, metadata !25, metadata !DIExpression()), !dbg !24
14*9880d681SAndroid Build Coastguard Worker  %0 = icmp ne i32 %i, 0, !dbg !27                ; <i1> [#uses=1]
15*9880d681SAndroid Build Coastguard Worker  br i1 %0, label %bb, label %bb1, !dbg !27
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerbb:                                               ; preds = %entry
18*9880d681SAndroid Build Coastguard Worker  %1 = getelementptr inbounds %struct.SVal, %struct.SVal* %location, i32 0, i32 1, !dbg !29 ; <i32*> [#uses=1]
19*9880d681SAndroid Build Coastguard Worker  %2 = load i32, i32* %1, align 8, !dbg !29            ; <i32> [#uses=1]
20*9880d681SAndroid Build Coastguard Worker  %3 = add i32 %2, %i, !dbg !29                   ; <i32> [#uses=1]
21*9880d681SAndroid Build Coastguard Worker  br label %bb2, !dbg !29
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workerbb1:                                              ; preds = %entry
24*9880d681SAndroid Build Coastguard Worker  %4 = getelementptr inbounds %struct.SVal, %struct.SVal* %location, i32 0, i32 1, !dbg !30 ; <i32*> [#uses=1]
25*9880d681SAndroid Build Coastguard Worker  %5 = load i32, i32* %4, align 8, !dbg !30            ; <i32> [#uses=1]
26*9880d681SAndroid Build Coastguard Worker  %6 = sub i32 %5, 1, !dbg !30                    ; <i32> [#uses=1]
27*9880d681SAndroid Build Coastguard Worker  br label %bb2, !dbg !30
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workerbb2:                                              ; preds = %bb1, %bb
30*9880d681SAndroid Build Coastguard Worker  %.0 = phi i32 [ %3, %bb ], [ %6, %bb1 ]         ; <i32> [#uses=1]
31*9880d681SAndroid Build Coastguard Worker  br label %return, !dbg !29
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Workerreturn:                                           ; preds = %bb2
34*9880d681SAndroid Build Coastguard Worker  ret i32 %.0, !dbg !29
35*9880d681SAndroid Build Coastguard Worker}
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workerdefine linkonce_odr void @_ZN4SValC1Ev(%struct.SVal* %this) nounwind ssp align 2  !dbg !16 {
38*9880d681SAndroid Build Coastguard Workerentry:
39*9880d681SAndroid Build Coastguard Worker  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
40*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.value(metadata %struct.SVal* %this, i64 0, metadata !31, metadata !DIExpression()), !dbg !34
41*9880d681SAndroid Build Coastguard Worker  %0 = getelementptr inbounds %struct.SVal, %struct.SVal* %this, i32 0, i32 0, !dbg !34 ; <i8**> [#uses=1]
42*9880d681SAndroid Build Coastguard Worker  store i8* null, i8** %0, align 8, !dbg !34
43*9880d681SAndroid Build Coastguard Worker  %1 = getelementptr inbounds %struct.SVal, %struct.SVal* %this, i32 0, i32 1, !dbg !34 ; <i32*> [#uses=1]
44*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* %1, align 8, !dbg !34
45*9880d681SAndroid Build Coastguard Worker  br label %return, !dbg !34
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Workerreturn:                                           ; preds = %entry
48*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !35
49*9880d681SAndroid Build Coastguard Worker}
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Workerdefine i32 @main() nounwind ssp !dbg !20 {
54*9880d681SAndroid Build Coastguard Workerentry:
55*9880d681SAndroid Build Coastguard Worker  %0 = alloca %struct.SVal                        ; <%struct.SVal*> [#uses=3]
56*9880d681SAndroid Build Coastguard Worker  %v = alloca %struct.SVal                        ; <%struct.SVal*> [#uses=4]
57*9880d681SAndroid Build Coastguard Worker  %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
58*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %struct.SVal* %v, metadata !38, metadata !DIExpression()), !dbg !41
59*9880d681SAndroid Build Coastguard Worker  call void @_ZN4SValC1Ev(%struct.SVal* %v) nounwind, !dbg !41
60*9880d681SAndroid Build Coastguard Worker  %1 = getelementptr inbounds %struct.SVal, %struct.SVal* %v, i32 0, i32 1, !dbg !42 ; <i32*> [#uses=1]
61*9880d681SAndroid Build Coastguard Worker  store i32 1, i32* %1, align 8, !dbg !42
62*9880d681SAndroid Build Coastguard Worker  %2 = getelementptr inbounds %struct.SVal, %struct.SVal* %0, i32 0, i32 0, !dbg !43 ; <i8**> [#uses=1]
63*9880d681SAndroid Build Coastguard Worker  %3 = getelementptr inbounds %struct.SVal, %struct.SVal* %v, i32 0, i32 0, !dbg !43 ; <i8**> [#uses=1]
64*9880d681SAndroid Build Coastguard Worker  %4 = load i8*, i8** %3, align 8, !dbg !43            ; <i8*> [#uses=1]
65*9880d681SAndroid Build Coastguard Worker  store i8* %4, i8** %2, align 8, !dbg !43
66*9880d681SAndroid Build Coastguard Worker  %5 = getelementptr inbounds %struct.SVal, %struct.SVal* %0, i32 0, i32 1, !dbg !43 ; <i32*> [#uses=1]
67*9880d681SAndroid Build Coastguard Worker  %6 = getelementptr inbounds %struct.SVal, %struct.SVal* %v, i32 0, i32 1, !dbg !43 ; <i32*> [#uses=1]
68*9880d681SAndroid Build Coastguard Worker  %7 = load i32, i32* %6, align 8, !dbg !43            ; <i32> [#uses=1]
69*9880d681SAndroid Build Coastguard Worker  store i32 %7, i32* %5, align 8, !dbg !43
70*9880d681SAndroid Build Coastguard Worker  %8 = call i32 @_Z3fooi4SVal(i32 2, %struct.SVal* noalias %0) nounwind, !dbg !43 ; <i32> [#uses=0]
71*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.value(metadata i32 %8, i64 0, metadata !44, metadata !DIExpression()), !dbg !43
72*9880d681SAndroid Build Coastguard Worker  br label %return, !dbg !45
73*9880d681SAndroid Build Coastguard Worker
74*9880d681SAndroid Build Coastguard Workerreturn:                                           ; preds = %entry
75*9880d681SAndroid Build Coastguard Worker  ret i32 0, !dbg !45
76*9880d681SAndroid Build Coastguard Worker}
77*9880d681SAndroid Build Coastguard Worker
78*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
79*9880d681SAndroid Build Coastguard Worker
80*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!3}
81*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!49}
82*9880d681SAndroid Build Coastguard Worker
83*9880d681SAndroid Build Coastguard Worker!0 = !DISubprogram(name: "SVal", line: 11, isLocal: false, isDefinition: false, virtualIndex: 6, isOptimized: false, file: !48, scope: !1, type: !14)
84*9880d681SAndroid Build Coastguard Worker!1 = !DICompositeType(tag: DW_TAG_structure_type, name: "SVal", line: 1, size: 64, align: 64, file: !48, elements: !4)
85*9880d681SAndroid Build Coastguard Worker!2 = !DIFile(filename: "small.cc", directory: "/Users/manav/R8248330")
86*9880d681SAndroid Build Coastguard Worker!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: false, emissionKind: FullDebug, file: !48, enums: !47, retainedTypes: !47, globals: !47, imports:  !47)
87*9880d681SAndroid Build Coastguard Worker!4 = !{!5, !7, !0, !9}
88*9880d681SAndroid Build Coastguard Worker!5 = !DIDerivedType(tag: DW_TAG_member, name: "Data", line: 7, size: 64, align: 64, file: !48, scope: !1, baseType: !6)
89*9880d681SAndroid Build Coastguard Worker!6 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !48, baseType: null)
90*9880d681SAndroid Build Coastguard Worker!7 = !DIDerivedType(tag: DW_TAG_member, name: "Kind", line: 8, size: 32, align: 32, offset: 64, file: !48, scope: !1, baseType: !8)
91*9880d681SAndroid Build Coastguard Worker!8 = !DIBasicType(tag: DW_TAG_base_type, name: "unsigned int", size: 32, align: 32, encoding: DW_ATE_unsigned)
92*9880d681SAndroid Build Coastguard Worker!9 = !DISubprogram(name: "~SVal", line: 12, isLocal: false, isDefinition: false, virtualIndex: 6, isOptimized: false, file: !48, scope: !1, type: !10)
93*9880d681SAndroid Build Coastguard Worker!10 = !DISubroutineType(types: !11)
94*9880d681SAndroid Build Coastguard Worker!11 = !{null, !12, !13}
95*9880d681SAndroid Build Coastguard Worker!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !48, baseType: !1)
96*9880d681SAndroid Build Coastguard Worker!13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
97*9880d681SAndroid Build Coastguard Worker!14 = !DISubroutineType(types: !15)
98*9880d681SAndroid Build Coastguard Worker!15 = !{null, !12}
99*9880d681SAndroid Build Coastguard Worker!16 = distinct !DISubprogram(name: "SVal", linkageName: "_ZN4SValC1Ev", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !3, file: !48, scope: !1, type: !14)
100*9880d681SAndroid Build Coastguard Worker!17 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi4SVal", line: 16, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !3, file: !48, scope: !2, type: !18)
101*9880d681SAndroid Build Coastguard Worker!18 = !DISubroutineType(types: !19)
102*9880d681SAndroid Build Coastguard Worker!19 = !{!13, !13, !1}
103*9880d681SAndroid Build Coastguard Worker!20 = distinct !DISubprogram(name: "main", linkageName: "main", line: 23, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !3, file: !48, scope: !2, type: !21)
104*9880d681SAndroid Build Coastguard Worker!21 = !DISubroutineType(types: !22)
105*9880d681SAndroid Build Coastguard Worker!22 = !{!13}
106*9880d681SAndroid Build Coastguard Worker!23 = !DILocalVariable(name: "i", line: 16, arg: 1, scope: !17, file: !2, type: !13)
107*9880d681SAndroid Build Coastguard Worker!24 = !DILocation(line: 16, scope: !17)
108*9880d681SAndroid Build Coastguard Worker!25 = !DILocalVariable(name: "location", line: 16, arg: 2, scope: !17, file: !2, type: !26)
109*9880d681SAndroid Build Coastguard Worker!26 = !DIDerivedType(tag: DW_TAG_reference_type, name: "SVal", size: 32, align: 32, file: !48, scope: !2, baseType: !1)
110*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 17, scope: !28)
111*9880d681SAndroid Build Coastguard Worker!28 = distinct !DILexicalBlock(line: 16, column: 0, file: !2, scope: !17)
112*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 18, scope: !28)
113*9880d681SAndroid Build Coastguard Worker!30 = !DILocation(line: 20, scope: !28)
114*9880d681SAndroid Build Coastguard Worker!31 = !DILocalVariable(name: "this", line: 11, arg: 1, scope: !16, file: !2, type: !32)
115*9880d681SAndroid Build Coastguard Worker!32 = !DIDerivedType(tag: DW_TAG_const_type, flags: DIFlagArtificial, file: !48, scope: !2, baseType: !33)
116*9880d681SAndroid Build Coastguard Worker!33 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 32, align: 32, file: !48, scope: !2, baseType: !1)
117*9880d681SAndroid Build Coastguard Worker!34 = !DILocation(line: 11, scope: !16)
118*9880d681SAndroid Build Coastguard Worker!35 = !DILocation(line: 11, scope: !36)
119*9880d681SAndroid Build Coastguard Worker!36 = distinct !DILexicalBlock(line: 11, column: 0, file: !48, scope: !37)
120*9880d681SAndroid Build Coastguard Worker!37 = distinct !DILexicalBlock(line: 11, column: 0, file: !48, scope: !16)
121*9880d681SAndroid Build Coastguard Worker!38 = !DILocalVariable(name: "v", line: 24, scope: !39, file: !2, type: !1)
122*9880d681SAndroid Build Coastguard Worker!39 = distinct !DILexicalBlock(line: 23, column: 0, file: !48, scope: !40)
123*9880d681SAndroid Build Coastguard Worker!40 = distinct !DILexicalBlock(line: 23, column: 0, file: !48, scope: !20)
124*9880d681SAndroid Build Coastguard Worker!41 = !DILocation(line: 24, scope: !39)
125*9880d681SAndroid Build Coastguard Worker!42 = !DILocation(line: 25, scope: !39)
126*9880d681SAndroid Build Coastguard Worker!43 = !DILocation(line: 26, scope: !39)
127*9880d681SAndroid Build Coastguard Worker!44 = !DILocalVariable(name: "k", line: 26, scope: !39, file: !2, type: !13)
128*9880d681SAndroid Build Coastguard Worker!45 = !DILocation(line: 27, scope: !39)
129*9880d681SAndroid Build Coastguard Worker!47 = !{}
130*9880d681SAndroid Build Coastguard Worker!48 = !DIFile(filename: "small.cc", directory: "/Users/manav/R8248330")
131*9880d681SAndroid Build Coastguard Worker!49 = !{i32 1, !"Debug Info Version", i32 3}
132