xref: /aosp_15_r20/external/llvm/test/DebugInfo/X86/discriminator2.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, int);
7*9880d681SAndroid Build Coastguard Worker; #2 int bar();
8*9880d681SAndroid Build Coastguard Worker; #3 void baz() {
9*9880d681SAndroid Build Coastguard Worker; #4   foo/*discriminator 1*/(bar(),
10*9880d681SAndroid Build Coastguard Worker; #5       bar());bar()/*discriminator 1*/;
11*9880d681SAndroid Build Coastguard Worker; #6 }
12*9880d681SAndroid Build Coastguard Worker;
13*9880d681SAndroid Build Coastguard Worker; The intent is to test discriminator 1 generated for both line #4 and #5.
14*9880d681SAndroid Build Coastguard Worker; The instruction sequence in the final binary is:
15*9880d681SAndroid Build Coastguard Worker; line 4 discriminator 0
16*9880d681SAndroid Build Coastguard Worker; line 5 discriminator 0
17*9880d681SAndroid Build Coastguard Worker; line 4 discriminator 1
18*9880d681SAndroid Build Coastguard Worker; line 5 discriminator 1
19*9880d681SAndroid Build Coastguard Worker; We need to ensure that the discriminators for the last two instructions
20*9880d681SAndroid Build Coastguard Worker; are both 1.
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; Function Attrs: uwtable
23*9880d681SAndroid Build Coastguard Workerdefine void @_Z3bazv() #0 !dbg !6 {
24*9880d681SAndroid Build Coastguard Worker  %1 = call i32 @_Z3barv(), !dbg !9
25*9880d681SAndroid Build Coastguard Worker  %2 = call i32 @_Z3barv(), !dbg !10
26*9880d681SAndroid Build Coastguard Worker  call void @_Z3fooii(i32 %1, i32 %2), !dbg !11
27*9880d681SAndroid Build Coastguard Worker  %3 = call i32 @_Z3barv(), !dbg !13
28*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !14
29*9880d681SAndroid Build Coastguard Worker}
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workerdeclare void @_Z3fooii(i32, i32) #1
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Workerdeclare i32 @_Z3barv() #1
34*9880d681SAndroid Build Coastguard Worker
35*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" }
36*9880d681SAndroid Build Coastguard Workerattributes #1 = { "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" }
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
39*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!3, !4}
40*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!5}
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 267219)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
43*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "test.cc", directory: ".")
44*9880d681SAndroid Build Coastguard Worker!2 = !{}
45*9880d681SAndroid Build Coastguard Worker!3 = !{i32 2, !"Dwarf Version", i32 4}
46*9880d681SAndroid Build Coastguard Worker!4 = !{i32 2, !"Debug Info Version", i32 3}
47*9880d681SAndroid Build Coastguard Worker!5 = !{!"clang version 3.9.0 (trunk 267219)"}
48*9880d681SAndroid Build Coastguard Worker!6 = distinct !DISubprogram(name: "baz", linkageName: "_Z3bazv", scope: !1, file: !1, line: 3, type: !7, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
49*9880d681SAndroid Build Coastguard Worker!7 = !DISubroutineType(types: !8)
50*9880d681SAndroid Build Coastguard Worker!8 = !{null}
51*9880d681SAndroid Build Coastguard Worker!9 = !DILocation(line: 4, column: 7, scope: !6)
52*9880d681SAndroid Build Coastguard Worker!10 = !DILocation(line: 5, column: 14, scope: !6)
53*9880d681SAndroid Build Coastguard Worker!11 = !DILocation(line: 4, column: 3, scope: !12)
54*9880d681SAndroid Build Coastguard Worker!12 = !DILexicalBlockFile(scope: !6, file: !1, discriminator: 1)
55*9880d681SAndroid Build Coastguard Worker!13 = !DILocation(line: 5, column: 21, scope: !12)
56*9880d681SAndroid Build Coastguard Worker!14 = !DILocation(line: 6, column: 1, scope: !6)
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Worker; CHECK: Address            Line   Column File   ISA Discriminator Flags
59*9880d681SAndroid Build Coastguard Worker; CHECK: ------------------ ------ ------ ------ --- ------------- -------------
60*9880d681SAndroid Build Coastguard Worker; CHECK: {{.*}}      4      3      1   0             1  {{.*}}
61*9880d681SAndroid Build Coastguard Worker; CHECK: {{.*}}      5     21      1   0             1  {{.*}}
62