xref: /aosp_15_r20/external/llvm/test/DebugInfo/X86/instcombine-instrinsics.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt %s -O2 -S -o - | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; Verify that we emit the same intrinsic at most once.
3*9880d681SAndroid Build Coastguard Worker; rdar://problem/13056109
4*9880d681SAndroid Build Coastguard Worker;
5*9880d681SAndroid Build Coastguard Worker; CHECK: call void @llvm.dbg.value(metadata %struct.i14** %p
6*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: call void @llvm.dbg.value(metadata %struct.i14** %p
7*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: call i32 @foo
8*9880d681SAndroid Build Coastguard Worker; CHECK: ret
9*9880d681SAndroid Build Coastguard Worker;
10*9880d681SAndroid Build Coastguard Worker;
11*9880d681SAndroid Build Coastguard Worker; typedef struct {
12*9880d681SAndroid Build Coastguard Worker;   long i;
13*9880d681SAndroid Build Coastguard Worker; } i14;
14*9880d681SAndroid Build Coastguard Worker;
15*9880d681SAndroid Build Coastguard Worker; int foo(i14**);
16*9880d681SAndroid Build Coastguard Worker;
17*9880d681SAndroid Build Coastguard Worker;   void init() {
18*9880d681SAndroid Build Coastguard Worker;     i14* p = 0;
19*9880d681SAndroid Build Coastguard Worker;     foo(&p);
20*9880d681SAndroid Build Coastguard Worker;     p->i |= 4;
21*9880d681SAndroid Build Coastguard Worker;     foo(&p);
22*9880d681SAndroid Build Coastguard Worker;   }
23*9880d681SAndroid Build Coastguard Worker;
24*9880d681SAndroid Build Coastguard Worker; ModuleID = 'instcombine_intrinsics.c'
25*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
26*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-apple-macosx10.9.0"
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker%struct.i14 = type { i64 }
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind ssp uwtable
31*9880d681SAndroid Build Coastguard Workerdefine void @init() #0 !dbg !4 {
32*9880d681SAndroid Build Coastguard Worker  %p = alloca %struct.i14*, align 8
33*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %struct.i14** %p, metadata !11, metadata !DIExpression()), !dbg !18
34*9880d681SAndroid Build Coastguard Worker  store %struct.i14* null, %struct.i14** %p, align 8, !dbg !18
35*9880d681SAndroid Build Coastguard Worker  %1 = call i32 @foo(%struct.i14** %p), !dbg !19
36*9880d681SAndroid Build Coastguard Worker  %2 = load %struct.i14*, %struct.i14** %p, align 8, !dbg !20
37*9880d681SAndroid Build Coastguard Worker  %3 = getelementptr inbounds %struct.i14, %struct.i14* %2, i32 0, i32 0, !dbg !20
38*9880d681SAndroid Build Coastguard Worker  %4 = load i64, i64* %3, align 8, !dbg !20
39*9880d681SAndroid Build Coastguard Worker  %5 = or i64 %4, 4, !dbg !20
40*9880d681SAndroid Build Coastguard Worker  store i64 %5, i64* %3, align 8, !dbg !20
41*9880d681SAndroid Build Coastguard Worker  %6 = call i32 @foo(%struct.i14** %p), !dbg !21
42*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !22
43*9880d681SAndroid Build Coastguard Worker}
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
46*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Workerdeclare i32 @foo(%struct.i14**)
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind ssp uwtable }
51*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone }
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
54*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!8, !9}
55*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!10}
56*9880d681SAndroid Build Coastguard Worker
57*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
58*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "instcombine_intrinsics.c", directory: "")
59*9880d681SAndroid Build Coastguard Worker!2 = !{}
60*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "init", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !5, type: !6, variables: !2)
61*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "instcombine_intrinsics.c", directory: "")
62*9880d681SAndroid Build Coastguard Worker!6 = !DISubroutineType(types: !7)
63*9880d681SAndroid Build Coastguard Worker!7 = !{null}
64*9880d681SAndroid Build Coastguard Worker!8 = !{i32 2, !"Dwarf Version", i32 2}
65*9880d681SAndroid Build Coastguard Worker!9 = !{i32 1, !"Debug Info Version", i32 3}
66*9880d681SAndroid Build Coastguard Worker!10 = !{!"clang version 3.5.0 "}
67*9880d681SAndroid Build Coastguard Worker!11 = !DILocalVariable(name: "p", line: 8, scope: !4, file: !5, type: !12)
68*9880d681SAndroid Build Coastguard Worker!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !13)
69*9880d681SAndroid Build Coastguard Worker!13 = !DIDerivedType(tag: DW_TAG_typedef, name: "i14", line: 3, file: !1, baseType: !14)
70*9880d681SAndroid Build Coastguard Worker!14 = !DICompositeType(tag: DW_TAG_structure_type, line: 1, size: 64, align: 64, file: !1, elements: !15)
71*9880d681SAndroid Build Coastguard Worker!15 = !{!16}
72*9880d681SAndroid Build Coastguard Worker!16 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 2, size: 64, align: 64, file: !1, scope: !14, baseType: !17)
73*9880d681SAndroid Build Coastguard Worker!17 = !DIBasicType(tag: DW_TAG_base_type, name: "long int", size: 64, align: 64, encoding: DW_ATE_signed)
74*9880d681SAndroid Build Coastguard Worker!18 = !DILocation(line: 8, scope: !4)
75*9880d681SAndroid Build Coastguard Worker!19 = !DILocation(line: 9, scope: !4)
76*9880d681SAndroid Build Coastguard Worker!20 = !DILocation(line: 10, scope: !4)
77*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 11, scope: !4)
78*9880d681SAndroid Build Coastguard Worker!22 = !DILocation(line: 12, scope: !4)
79