xref: /aosp_15_r20/external/llvm/test/DebugInfo/X86/discriminator3.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=i386-unknown-unknown -mcpu=core2 %s -o %t -filetype=obj
2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump -debug-dump=line %t | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker;
4*9880d681SAndroid Build Coastguard Worker; Generated from:
5*9880d681SAndroid Build Coastguard Worker;
6*9880d681SAndroid Build Coastguard Worker; #1 void foo(int);
7*9880d681SAndroid Build Coastguard Worker; #2 void baz(int i) {
8*9880d681SAndroid Build Coastguard Worker; #3   if (i) {foo(i+1);/*discriminator 1*/}
9*9880d681SAndroid Build Coastguard Worker; #4 }
10*9880d681SAndroid Build Coastguard Worker;
11*9880d681SAndroid Build Coastguard Worker; The intent is to test discriminator 1 generated for all instructions in
12*9880d681SAndroid Build Coastguard Worker; the taken branch.
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; Function Attrs: uwtable
15*9880d681SAndroid Build Coastguard Workerdefine void @_Z3bazi(i32) #0 !dbg !6 {
16*9880d681SAndroid Build Coastguard Worker  %2 = alloca i32, align 4
17*9880d681SAndroid Build Coastguard Worker  store i32 %0, i32* %2, align 4
18*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata i32* %2, metadata !10, metadata !11), !dbg !12
19*9880d681SAndroid Build Coastguard Worker  %3 = load i32, i32* %2, align 4, !dbg !13
20*9880d681SAndroid Build Coastguard Worker  %4 = icmp ne i32 %3, 0, !dbg !13
21*9880d681SAndroid Build Coastguard Worker  br i1 %4, label %5, label %8, !dbg !15
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker; <label>:5:                                      ; preds = %1
24*9880d681SAndroid Build Coastguard Worker  %6 = load i32, i32* %2, align 4, !dbg !16
25*9880d681SAndroid Build Coastguard Worker  %7 = add nsw i32 %6, 1, !dbg !19
26*9880d681SAndroid Build Coastguard Worker  call void @_Z3fooi(i32 %7), !dbg !20
27*9880d681SAndroid Build Coastguard Worker  br label %8, !dbg !21
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker; <label>:8:                                      ; preds = %5, %1
30*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !22
31*9880d681SAndroid Build Coastguard Worker}
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
34*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Workerdeclare void @_Z3fooi(i32) #2
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workerattributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
39*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone }
40*9880d681SAndroid Build Coastguard Workerattributes #2 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
43*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!3, !4}
44*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!5}
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 267518)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
47*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "test.cc", directory: ".")
48*9880d681SAndroid Build Coastguard Worker!2 = !{}
49*9880d681SAndroid Build Coastguard Worker!3 = !{i32 2, !"Dwarf Version", i32 4}
50*9880d681SAndroid Build Coastguard Worker!4 = !{i32 2, !"Debug Info Version", i32 3}
51*9880d681SAndroid Build Coastguard Worker!5 = !{!"clang version 3.9.0 (trunk 267518)"}
52*9880d681SAndroid Build Coastguard Worker!6 = distinct !DISubprogram(name: "baz", linkageName: "_Z3bazi", scope: !1, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
53*9880d681SAndroid Build Coastguard Worker!7 = !DISubroutineType(types: !8)
54*9880d681SAndroid Build Coastguard Worker!8 = !{null, !9}
55*9880d681SAndroid Build Coastguard Worker!9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
56*9880d681SAndroid Build Coastguard Worker!10 = !DILocalVariable(name: "i", arg: 1, scope: !6, file: !1, line: 2, type: !9)
57*9880d681SAndroid Build Coastguard Worker!11 = !DIExpression()
58*9880d681SAndroid Build Coastguard Worker!12 = !DILocation(line: 2, column: 14, scope: !6)
59*9880d681SAndroid Build Coastguard Worker!13 = !DILocation(line: 3, column: 7, scope: !14)
60*9880d681SAndroid Build Coastguard Worker!14 = distinct !DILexicalBlock(scope: !6, file: !1, line: 3, column: 7)
61*9880d681SAndroid Build Coastguard Worker!15 = !DILocation(line: 3, column: 7, scope: !6)
62*9880d681SAndroid Build Coastguard Worker!16 = !DILocation(line: 3, column: 15, scope: !17)
63*9880d681SAndroid Build Coastguard Worker!17 = !DILexicalBlockFile(scope: !18, file: !1, discriminator: 1)
64*9880d681SAndroid Build Coastguard Worker!18 = distinct !DILexicalBlock(scope: !14, file: !1, line: 3, column: 10)
65*9880d681SAndroid Build Coastguard Worker!19 = !DILocation(line: 3, column: 16, scope: !17)
66*9880d681SAndroid Build Coastguard Worker!20 = !DILocation(line: 3, column: 11, scope: !17)
67*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 3, column: 21, scope: !17)
68*9880d681SAndroid Build Coastguard Worker!22 = !DILocation(line: 4, column: 1, scope: !6)
69*9880d681SAndroid Build Coastguard Worker
70*9880d681SAndroid Build Coastguard Worker; CHECK: Address            Line   Column File   ISA Discriminator Flags
71*9880d681SAndroid Build Coastguard Worker; CHECK: ------------------ ------ ------ ------ --- ------------- -------------
72*9880d681SAndroid Build Coastguard Worker; CHECK: {{.*}}      3     15      1   0             1
73*9880d681SAndroid Build Coastguard Worker; CHECK: {{.*}}      3     16      1   0             1
74*9880d681SAndroid Build Coastguard Worker; CHECK: {{.*}}      3     11      1   0             1
75