@@ -134,3 +134,35 @@ define void @dyn_inst_alloca_array_zext(i8 %a) {
134
134
; CHECK-NEXT: zext i8 %b to i32
135
135
; CHECK-NEXT: mul i32 4,
136
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: DIFlagPrototyped, 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 , imports: !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, isOptimized: 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 )
0 commit comments