xref: /aosp_15_r20/external/llvm/test/DebugInfo/X86/inlined-indirect-value.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -filetype=asm -asm-verbose=0 < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; "1" from line 09 in the snippet below shouldn't be marked with location of "1"
4*9880d681SAndroid Build Coastguard Worker; from line 04.  Instead it will have location inside main() (real location is
5*9880d681SAndroid Build Coastguard Worker; just erased, so it won't be perfectly accurate).
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker; options: -g -O3
8*9880d681SAndroid Build Coastguard Worker; 01 volatile int x;
9*9880d681SAndroid Build Coastguard Worker; 02 int y;
10*9880d681SAndroid Build Coastguard Worker; 03 static __attribute__((always_inline)) int f1() {
11*9880d681SAndroid Build Coastguard Worker; 04     if (x * 3 < 14) return 1;
12*9880d681SAndroid Build Coastguard Worker; 05     return 2;
13*9880d681SAndroid Build Coastguard Worker; 06 }
14*9880d681SAndroid Build Coastguard Worker; 07 int main() {
15*9880d681SAndroid Build Coastguard Worker; 08     x = f1();
16*9880d681SAndroid Build Coastguard Worker; 09     x = x ? 1 : 2;
17*9880d681SAndroid Build Coastguard Worker; 10 }
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
20*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-linux-gnu"
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker@x = common global i32 0, align 4
23*9880d681SAndroid Build Coastguard Worker@y = common global i32 0, align 4
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workerdefine i32 @main() !dbg !4 {
26*9880d681SAndroid Build Coastguard Worker; CHECK: .loc 1 {{[89]}}
27*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: .loc
28*9880d681SAndroid Build Coastguard Worker; CHECK: movl $1
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerentry:
31*9880d681SAndroid Build Coastguard Worker  %0 = load volatile i32, i32* @x, align 4, !dbg !16, !tbaa !19
32*9880d681SAndroid Build Coastguard Worker  %mul.i = mul nsw i32 %0, 3, !dbg !23
33*9880d681SAndroid Build Coastguard Worker  %cmp.i = icmp slt i32 %mul.i, 14, !dbg !24
34*9880d681SAndroid Build Coastguard Worker  %..i = select i1 %cmp.i, i32 1, i32 2, !dbg !25
35*9880d681SAndroid Build Coastguard Worker  store volatile i32 %..i, i32* @x, align 4, !dbg !27, !tbaa !19
36*9880d681SAndroid Build Coastguard Worker  %1 = load volatile i32, i32* @x, align 4, !dbg !28, !tbaa !19
37*9880d681SAndroid Build Coastguard Worker  %tobool = icmp ne i32 %1, 0, !dbg !28
38*9880d681SAndroid Build Coastguard Worker  br i1 %tobool, label %select.end, label %select.mid
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workerselect.mid:                                       ; preds = %entry
41*9880d681SAndroid Build Coastguard Worker  br label %select.end
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerselect.end:                                       ; preds = %entry, %select.mid
44*9880d681SAndroid Build Coastguard Worker  %cond = phi i32 [ 1, %entry ], [ 2, %select.mid ]
45*9880d681SAndroid Build Coastguard Worker  store volatile i32 %cond, i32* @x, align 4, !dbg !29, !tbaa !19
46*9880d681SAndroid Build Coastguard Worker  ret i32 0, !dbg !30
47*9880d681SAndroid Build Coastguard Worker}
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
50*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!13, !14}
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !9, imports: !2)
53*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "inline-break.c", directory: "/build/dir")
54*9880d681SAndroid Build Coastguard Worker!2 = !{}
55*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 7, type: !5, isLocal: false, isDefinition: true, scopeLine: 7, isOptimized: true, unit: !0, variables: !2)
56*9880d681SAndroid Build Coastguard Worker!5 = !DISubroutineType(types: !6)
57*9880d681SAndroid Build Coastguard Worker!6 = !{!7}
58*9880d681SAndroid Build Coastguard Worker!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
59*9880d681SAndroid Build Coastguard Worker!8 = distinct !DISubprogram(name: "f1", scope: !1, file: !1, line: 3, type: !5, isLocal: true, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, variables: !2)
60*9880d681SAndroid Build Coastguard Worker!9 = !{!10, !12}
61*9880d681SAndroid Build Coastguard Worker!10 = !DIGlobalVariable(name: "x", scope: !0, file: !1, line: 1, type: !11, isLocal: false, isDefinition: true, variable: i32* @x)
62*9880d681SAndroid Build Coastguard Worker!11 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
63*9880d681SAndroid Build Coastguard Worker!12 = !DIGlobalVariable(name: "y", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, variable: i32* @y)
64*9880d681SAndroid Build Coastguard Worker!13 = !{i32 2, !"Dwarf Version", i32 4}
65*9880d681SAndroid Build Coastguard Worker!14 = !{i32 2, !"Debug Info Version", i32 3}
66*9880d681SAndroid Build Coastguard Worker!16 = !DILocation(line: 4, column: 9, scope: !17, inlinedAt: !18)
67*9880d681SAndroid Build Coastguard Worker!17 = distinct !DILexicalBlock(scope: !8, file: !1, line: 4, column: 9)
68*9880d681SAndroid Build Coastguard Worker!18 = distinct !DILocation(line: 8, column: 9, scope: !4)
69*9880d681SAndroid Build Coastguard Worker!19 = !{!20, !20, i64 0}
70*9880d681SAndroid Build Coastguard Worker!20 = !{!"int", !21, i64 0}
71*9880d681SAndroid Build Coastguard Worker!21 = !{!"omnipotent char", !22, i64 0}
72*9880d681SAndroid Build Coastguard Worker!22 = !{!"Simple C/C++ TBAA"}
73*9880d681SAndroid Build Coastguard Worker!23 = !DILocation(line: 4, column: 11, scope: !17, inlinedAt: !18)
74*9880d681SAndroid Build Coastguard Worker!24 = !DILocation(line: 4, column: 15, scope: !17, inlinedAt: !18)
75*9880d681SAndroid Build Coastguard Worker!25 = !DILocation(line: 4, column: 21, scope: !26, inlinedAt: !18)
76*9880d681SAndroid Build Coastguard Worker!26 = !DILexicalBlockFile(scope: !17, file: !1, discriminator: 1)
77*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 8, column: 7, scope: !4)
78*9880d681SAndroid Build Coastguard Worker!28 = !DILocation(line: 9, column: 9, scope: !4)
79*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 9, column: 7, scope: !4)
80*9880d681SAndroid Build Coastguard Worker!30 = !DILocation(line: 10, column: 1, scope: !4)
81