1 ; RUN: opt -instcombine -S %s | FileCheck %s
3 define dso_local void @_Z1fv() {
4 %1 = alloca i32, align 4
5 %2 = bitcast i32* %1 to i8*
6 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %2)
7 call void @llvm.dbg.declare(metadata i32* %1, metadata !16, metadata !DIExpression()), !dbg !19
8 ; CHECK: %[[A:.*]] = alloca i32, align 4
9 ; CHECK: call void @llvm.dbg.value(metadata i32* %[[A]], {{.*}}, metadata !DIExpression(DW_OP_deref)
10 ; CHECK: call void @_Z1gPv
11 call void @_Z1gPv(i8* nonnull %2)
12 %3 = bitcast i32* %1 to i8*
13 ; CHECK-NOT: call void @llvm.dbg.value
14 ; CHECK: call void @_Z1gPv
15 call void @_Z1gPv(i8* nonnull %3)
16 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %2)
20 define dso_local void @_Z2fv() {
21 %1 = alloca i32, align 4
22 %2 = bitcast i32* %1 to i8*
23 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %2)
24 call void @llvm.dbg.declare(metadata i32* %1, metadata !16, metadata !DIExpression()), !dbg !19
25 ; CHECK: %[[A:.*]] = alloca i32, align 4
26 ; CHECK: call void @llvm.dbg.value(metadata i32* %[[A]], {{.*}}, metadata !DIExpression(DW_OP_deref)
27 ; CHECK: call void @_Z1gPv
28 call void @_Z1gPv(i8* nonnull %2)
32 %3 = bitcast i32* %1 to i8*
33 ; CHECK: call void @llvm.dbg.value(metadata i32* %[[A]], {{.*}}, metadata !DIExpression(DW_OP_deref)
34 ; CHECK: call void @_Z1gPv
35 call void @_Z1gPv(i8* nonnull %3)
36 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %2)
40 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
41 declare void @llvm.dbg.declare(metadata, metadata, metadata)
42 declare dso_local void @_Z1gPv(i8*)
43 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
46 !llvm.module.flags = !{!8, !9, !10}
48 !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)
49 !1 = !DIFile(filename: "dbg.cc", directory: "/tmp")
52 !4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
53 !5 = !DISubprogram(name: "g", linkageName: "_Z1gPv", scope: !1, file: !1, line: 1, type: !6, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
54 !6 = !DISubroutineType(types: !7)
56 !8 = !{i32 7, !"Dwarf Version", i32 4}
57 !9 = !{i32 2, !"Debug Info Version", i32 3}
58 !10 = !{i32 1, !"wchar_size", i32 4}
59 !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)
60 !13 = !DISubroutineType(types: !14)
63 !16 = !DILocalVariable(name: "x", scope: !12, file: !1, line: 3, type: !17)
64 !17 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
65 !18 = !DILocation(line: 3, column: 3, scope: !12)
66 !19 = !DILocation(line: 3, column: 7, scope: !12)
67 !20 = !DILocation(line: 4, column: 3, scope: !12)
68 !21 = !DILocation(line: 5, column: 1, scope: !12)