1 ; RUN: opt -passes=instcombine -S %s | FileCheck %s
3 define dso_local void @_Z1fv() {
4 %1 = alloca i32, align 4
5 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1)
6 call void @llvm.dbg.declare(metadata ptr %1, metadata !16, metadata !DIExpression()), !dbg !19
7 ; CHECK: %[[A:.*]] = alloca i32, align 4
8 ; CHECK: #dbg_value(ptr %[[A]], {{.*}}, !DIExpression(DW_OP_deref)
9 ; CHECK: call void @_Z1gPv
10 call void @_Z1gPv(ptr nonnull %1)
11 ; CHECK-NOT: #dbg_value
12 ; CHECK: call void @_Z1gPv
13 call void @_Z1gPv(ptr nonnull %1)
14 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1)
18 define dso_local void @_Z2fv() {
19 %1 = alloca i32, align 4
20 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1)
21 call void @llvm.dbg.declare(metadata ptr %1, metadata !16, metadata !DIExpression()), !dbg !19
22 ; CHECK: %[[A:.*]] = alloca i32, align 4
23 ; CHECK: #dbg_value(ptr %[[A]], {{.*}}, !DIExpression(DW_OP_deref)
24 ; CHECK: call void @_Z1gPv
25 call void @_Z1gPv(ptr nonnull %1)
29 ; CHECK: #dbg_value(ptr %[[A]], {{.*}}, !DIExpression(DW_OP_deref)
30 ; CHECK: call void @_Z1gPv
31 call void @_Z1gPv(ptr nonnull %1)
32 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1)
36 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
37 declare void @llvm.dbg.declare(metadata, metadata, metadata)
38 declare dso_local void @_Z1gPv(ptr)
39 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
42 !llvm.module.flags = !{!8, !9, !10}
44 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 10.0.0 (git@github.com:llvm/llvm-project.git cab64b5708f614c71d275ec9d134e68b8c3baedd)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
45 !1 = !DIFile(filename: "dbg.cc", directory: "/tmp")
48 !4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
49 !5 = !DISubprogram(name: "g", linkageName: "_Z1gPv", scope: !1, file: !1, line: 1, type: !6, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
50 !6 = !DISubroutineType(types: !7)
52 !8 = !{i32 7, !"Dwarf Version", i32 4}
53 !9 = !{i32 2, !"Debug Info Version", i32 3}
54 !10 = !{i32 1, !"wchar_size", i32 4}
55 !12 = distinct !DISubprogram(name: "f", linkageName: "_Z1fv", scope: !1, file: !1, line: 2, type: !13, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
56 !13 = !DISubroutineType(types: !14)
59 !16 = !DILocalVariable(name: "x", scope: !12, file: !1, line: 3, type: !17)
60 !17 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
61 !18 = !DILocation(line: 3, column: 3, scope: !12)
62 !19 = !DILocation(line: 3, column: 7, scope: !12)
63 !20 = !DILocation(line: 4, column: 3, scope: !12)
64 !21 = !DILocation(line: 5, column: 1, scope: !12)