xref: /llvm-project/llvm/test/DebugInfo/Generic/apple-names-hash-collisions.ll (revision e88fee1fec6e69b7a1d55242146e9e311eebaba0)
1; XFAIL: target={{.*}}-aix{{.*}}
2; RUN: %llc_dwarf -accel-tables=Apple -filetype=obj -o %t < %s
3; RUN: llvm-dwarfdump -apple-names %t | FileCheck %s --check-prefix=NUM_HASHES
4; RUN: llvm-dwarfdump  --find=bb --find=cA %t | FileCheck %s --check-prefix=FOUND_VARS
5; RUN: llvm-dwarfdump  --find-all-apple %t | FileCheck %s --check-prefix=ALL_ENTRIES
6
7
8; The strings 'bb' and 'cA' hash to the same value under the Apple accelerator
9; table hashing algorithm.
10; We first test that there is exactly one bucket and one hash.
11; Then we check that both values are found.
12
13; NUM_HASHES:      Bucket count: 2
14; NUM_HASHES-NEXT: Hashes count: 2
15; FOUND_VARS: DW_AT_name        ("bb")
16; FOUND_VARS: DW_AT_name        ("cA")
17
18; ALL_ENTRIES: Apple accelerator entries with name = "bb":
19; ALL_ENTRIES: DW_AT_name        ("bb")
20; ALL_ENTRIES: Apple accelerator entries with name = "cA":
21; ALL_ENTRIES: DW_AT_name        ("cA")
22; ALL_ENTRIES: Apple accelerator entries with name = "some_other_hash":
23; ALL_ENTRIES: DW_AT_name        ("some_other_hash")
24; ALL_ENTRIES: Apple accelerator entries with name = "int":
25; ALL_ENTRIES: DW_AT_name        ("int")
26
27@bb = global i32 200, align 4, !dbg !0
28@cA = global i32 10, align 4, !dbg !5
29@some_other_hash = global i32 10, !dbg !17
30
31!llvm.module.flags = !{!9, !10, !11, !12, !13}
32!llvm.dbg.cu = !{!2}
33!llvm.ident = !{!15}
34
35!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
36!1 = distinct !DIGlobalVariable(name: "bb", scope: !2, file: !3, line: 1, type: !7, isDefinition: true)
37!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "", emissionKind: FullDebug, globals: !4)
38!3 = !DIFile(filename: "test.cpp", directory: "blah")
39!4 = !{!0, !5, !17}
40!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
41!6 = distinct !DIGlobalVariable(name: "cA", scope: !2, file: !3, line: 2, type: !7, isLocal: false, isDefinition: true)
42!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
43!9 = !{i32 7, !"Dwarf Version", i32 4}
44!10 = !{i32 2, !"Debug Info Version", i32 3}
45!11 = !{i32 1, !"wchar_size", i32 4}
46!12 = !{i32 8, !"PIC Level", i32 2}
47!13 = !{i32 7, !"uwtable", i32 1}
48!15 = !{!"blah"}
49!16 = distinct !DIGlobalVariable(name: "some_other_hash", scope: !2, file: !3, line: 2, type: !7, isLocal: false, isDefinition: true)
50!17 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression())
51