OLD | NEW |
1 ; RUN: opt < %s -simplify-allocas -S | FileCheck %s | 1 ; RUN: opt < %s -simplify-allocas -S | FileCheck %s |
2 | 2 |
3 target datalayout = "p:32:32:32" | 3 target datalayout = "p:32:32:32" |
4 | 4 |
5 %struct = type { i32, i32 } | 5 %struct = type { i32, i32 } |
6 | 6 |
7 declare void @receive_alloca(%struct* %ptr) | 7 declare void @receive_alloca(%struct* %ptr) |
8 declare void @receive_vector_alloca(<4 x i32>* %ptr) | 8 declare void @receive_vector_alloca(<4 x i32>* %ptr) |
9 | 9 |
10 define void @alloca_fixed() { | 10 define void @alloca_fixed() { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 } | 131 } |
132 ; CHECK-LABEL: define void @dyn_inst_alloca_array_zext(i8 %a) | 132 ; CHECK-LABEL: define void @dyn_inst_alloca_array_zext(i8 %a) |
133 ; CHECK-NEXT: %b = add i8 1, %a | 133 ; CHECK-NEXT: %b = add i8 1, %a |
134 ; CHECK-NEXT: zext i8 %b to i32 | 134 ; CHECK-NEXT: zext i8 %b to i32 |
135 ; CHECK-NEXT: mul i32 4, | 135 ; CHECK-NEXT: mul i32 4, |
136 ; CHECK-NEXT: %c = alloca i8, i32 | 136 ; CHECK-NEXT: %c = alloca i8, i32 |
137 | 137 |
138 declare void @llvm.dbg.declare(metadata, metadata, metadata) | 138 declare void @llvm.dbg.declare(metadata, metadata, metadata) |
139 define void @debug_declare() { | 139 define void @debug_declare() { |
140 %var = alloca i32 | 140 %var = alloca i32 |
141 call void @llvm.dbg.declare(metadata i32* %var, metadata !11, metadata !12), !
dbg !13 | 141 call void @llvm.dbg.declare(metadata i32* %var, metadata !12, metadata !13), !
dbg !14 |
142 unreachable | 142 unreachable |
143 } | 143 } |
144 ; Ensure that the first arg to dbg.declare points to the alloca, not the bitcast | 144 ; Ensure that the first arg to dbg.declare points to the alloca, not the bitcast |
145 ; CHECK-LABEL: define void @debug_declare | 145 ; CHECK-LABEL: define void @debug_declare |
146 ; CHECK-NEXT: %var = alloca i8, i32 4 | 146 ; CHECK-NEXT: %var = alloca i8, i32 4 |
147 ; CHECK: call void @llvm.dbg.declare(metadata i8* %var, metadata !11, metadata !
12), !dbg !13 | 147 ; CHECK: call void @llvm.dbg.declare(metadata i8* %var, metadata !12, metadata !
13), !dbg !14 |
| 148 |
| 149 define void @debug_declare_morecasts() { |
| 150 %var = alloca i32, i32 2, align 8 |
| 151 %other_bc = bitcast i32* %var to i64* |
| 152 %other_bc2 = bitcast i64* %other_bc to i16* |
| 153 call void @llvm.dbg.declare(metadata i16* %other_bc2, metadata !15, metadata !
13), !dbg !16 |
| 154 unreachable |
| 155 } |
| 156 ; Ensure that the first arg to dbg.declare points to the alloca, not bitcasts |
| 157 ; CHECK-LABEL: define void @debug_declare_morecasts |
| 158 ; CHECK-NEXT: %var = alloca i8, i32 8, align 8 |
| 159 ; CHECK: call void @llvm.dbg.declare(metadata i8* %var, metadata !15, metadata !
13), !dbg !16 |
148 | 160 |
149 !llvm.dbg.cu = !{!0} | 161 !llvm.dbg.cu = !{!0} |
150 !llvm.module.flags = !{!8, !9} | 162 !llvm.module.flags = !{!9, !10} |
151 !llvm.ident = !{!10} | 163 !llvm.ident = !{!11} |
152 | 164 |
153 ; CHECK: !4 = !MDSubprogram(name: "debug_declare", scope: !1, file: !1, line: 1,
type: !5, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagProtot
yped, isOptimized: false, function: void ()* @debug_declare, variables: !2) | 165 ; CHECK: !4 = !MDSubprogram(name: "debug_declare", scope: !1, file: !1, line: 1,
type: !5, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagProtot
yped, isOptimized: false, function: void ()* @debug_declare, variables: !2) |
154 | 166 |
155 !0 = !MDCompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.
7.0 (trunk 235150) (llvm/trunk 235152)", isOptimized: false, runtimeVersion: 0,
emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imp
orts: !2) | 167 !0 = !MDCompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.
7.0 (trunk 235150) (llvm/trunk 235152)", isOptimized: false, runtimeVersion: 0,
emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imp
orts: !2) |
156 !1 = !MDFile(filename: "foo.c", directory: "/s/llvm/cmakebuild") | 168 !1 = !MDFile(filename: "foo.c", directory: "/s/llvm/cmakebuild") |
157 !2 = !{} | 169 !2 = !{} |
158 !3 = !{!4} | 170 !3 = !{!4, !8} |
159 !4 = !MDSubprogram(name: "debug_declare", scope: !1, file: !1, line: 1, type: !5
, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isO
ptimized: false, function: void ()* @debug_declare, variables: !2) | 171 !4 = !MDSubprogram(name: "debug_declare", scope: !1, file: !1, line: 1, type: !5
, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isO
ptimized: false, function: void ()* @debug_declare, variables: !2) |
160 !5 = !MDSubroutineType(types: !6) | 172 !5 = !MDSubroutineType(types: !6) |
161 !6 = !{null, !7} | 173 !6 = !{null, !7} |
162 !7 = !MDBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) | 174 !7 = !MDBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
163 !8 = !{i32 2, !"Dwarf Version", i32 4} | 175 !8 = !MDSubprogram(name: "debug_declare_morecasts", scope: !1, file: !1, line: 8
, type: !5, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagProto
typed, isOptimized: false, function: void ()* @debug_declare_morecasts, variable
s: !2) |
164 !9 = !{i32 2, !"Debug Info Version", i32 3} | 176 !9 = !{i32 2, !"Dwarf Version", i32 4} |
165 !10 = !{!"clang version 3.7.0 (trunk 235150) (llvm/trunk 235152)"} | 177 !10 = !{i32 2, !"Debug Info Version", i32 3} |
166 !11 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "val", arg: 1, scope: !4,
file: !1, line: 1, type: !7) | 178 !11 = !{!"clang version 3.7.0 (trunk 235150) (llvm/trunk 235152)"} |
167 !12 = !MDExpression() | 179 !12 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "val", arg: 1, scope: !4,
file: !1, line: 1, type: !7) |
168 !13 = !MDLocation(line: 1, column: 24, scope: !4) | 180 !13 = !MDExpression() |
| 181 !14 = !MDLocation(line: 1, column: 24, scope: !4) |
| 182 !15 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "var", arg: 1, scope: !8,
file: !1, line: 9, type: !7) |
| 183 !16 = !MDLocation(line: 9, column: 24, scope: !8) |
OLD | NEW |