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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 define void @dyn_inst_alloca_array_zext(i8 %a) { | 127 define void @dyn_inst_alloca_array_zext(i8 %a) { |
128 %b = add i8 1, %a | 128 %b = add i8 1, %a |
129 %c = alloca i32, i8 %b | 129 %c = alloca i32, i8 %b |
130 unreachable | 130 unreachable |
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 |
| 138 declare void @llvm.dbg.declare(metadata, metadata, metadata) |
| 139 define void @debug_declare() { |
| 140 %var = alloca i32 |
| 141 call void @llvm.dbg.declare(metadata i32* %var, metadata !11, metadata !12), !
dbg !13 |
| 142 unreachable |
| 143 } |
| 144 ; Ensure that the first arg to dbg.declare points to the alloca, not the bitcast |
| 145 ; CHECK-LABEL: define void @debug_declare |
| 146 ; CHECK-NEXT: %var = alloca i8, i32 4 |
| 147 ; CHECK: call void @llvm.dbg.declare(metadata i8* %var, metadata !11, metadata !
12), !dbg !13 |
| 148 |
| 149 !llvm.dbg.cu = !{!0} |
| 150 !llvm.module.flags = !{!8, !9} |
| 151 !llvm.ident = !{!10} |
| 152 |
| 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) |
| 154 |
| 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) |
| 156 !1 = !MDFile(filename: "foo.c", directory: "/s/llvm/cmakebuild") |
| 157 !2 = !{} |
| 158 !3 = !{!4} |
| 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) |
| 160 !5 = !MDSubroutineType(types: !6) |
| 161 !6 = !{null, !7} |
| 162 !7 = !MDBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 163 !8 = !{i32 2, !"Dwarf Version", i32 4} |
| 164 !9 = !{i32 2, !"Debug Info Version", i32 3} |
| 165 !10 = !{!"clang version 3.7.0 (trunk 235150) (llvm/trunk 235152)"} |
| 166 !11 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "val", arg: 1, scope: !4,
file: !1, line: 1, type: !7) |
| 167 !12 = !MDExpression() |
| 168 !13 = !MDLocation(line: 1, column: 24, scope: !4) |
OLD | NEW |