aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/tools
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/tools')
-rw-r--r--llvm/test/tools/llvm-dwarfdump/AArch64/DW_AT_APPLE_property.s126
-rw-r--r--llvm/test/tools/llvm-readobj/ELF/bb-addr-map-feature-warning.test37
-rw-r--r--llvm/test/tools/llvm-readobj/ELF/bb-addr-map-pgo-analysis-map.test17
-rw-r--r--llvm/test/tools/obj2yaml/ELF/bb-addr-map-pgo-analysis-map.yaml49
-rw-r--r--llvm/test/tools/yaml2obj/ELF/bb-addr-map-pgo-analysis-map.yaml25
-rw-r--r--llvm/test/tools/yaml2obj/ELF/bb-addr-map.yaml4
6 files changed, 219 insertions, 39 deletions
diff --git a/llvm/test/tools/llvm-dwarfdump/AArch64/DW_AT_APPLE_property.s b/llvm/test/tools/llvm-dwarfdump/AArch64/DW_AT_APPLE_property.s
new file mode 100644
index 0000000..6c38791
--- /dev/null
+++ b/llvm/test/tools/llvm-dwarfdump/AArch64/DW_AT_APPLE_property.s
@@ -0,0 +1,126 @@
+# Checks that we correctly display the DW_AT_APPLE_property_name of a
+# referenced DW_TAG_APPLE_property.
+#
+# RUN: llvm-mc -triple=aarch64--darwin -filetype=obj -o %t.o < %s
+# RUN: not llvm-dwarfdump %t.o 2> %t.errs.txt | FileCheck %s
+# RUN: FileCheck %s --check-prefix=ERRORS < %t.errs.txt
+
+# CHECK: 0x[[PROP_REF:[0-9a-f]+]]: DW_TAG_APPLE_property
+# CHECK-NEXT: DW_AT_APPLE_property_name ("autoSynthProp")
+#
+# CHECK: 0x[[NO_NAME_PROP:[0-9a-f]+]]: DW_TAG_APPLE_property
+# CHECK-NOT: DW_AT_APPLE_property_name
+#
+# CHECK: 0x[[INVALID_STRP:[0-9a-f]+]]: DW_TAG_APPLE_property
+# CHECK-NEXT: DW_AT_APPLE_property_name
+#
+# CHECK: DW_TAG_member
+# CHECK: DW_AT_APPLE_property (0x[[PROP_REF]] "autoSynthProp")
+# CHECK: DW_AT_APPLE_property (0x[[NO_NAME_PROP]] "")
+# CHECK: DW_AT_APPLE_property (0x{{.*}})
+# CHECK: DW_AT_APPLE_property (0x{{.*}})
+# CHECK: DW_AT_APPLE_property (0x[[INVALID_STRP]])
+
+# ERRORS: error: decoding DW_AT_APPLE_property_name: not referencing a DW_TAG_APPLE_property
+# ERRORS: error: decoding DW_AT_APPLE_property_name: invalid DIE
+# ERRORS: error: decoding DW_AT_APPLE_property_name: DW_FORM_strp offset 102 is beyond .debug_str bounds
+
+ .section __DWARF,__debug_abbrev,regular,debug
+Lsection_abbrev:
+ .byte 1 ; Abbreviation Code
+ .byte 17 ; DW_TAG_compile_unit
+ .byte 1 ; DW_CHILDREN_yes
+ .byte 114 ; DW_AT_str_offsets_base
+ .byte 23 ; DW_FORM_sec_offset
+ .byte 0 ; EOM(1)
+ .byte 0 ; EOM(2)
+ .byte 2 ; Abbreviation Code
+ .byte 19 ; DW_TAG_structure_type
+ .byte 1 ; DW_CHILDREN_yes
+ .byte 3 ; DW_AT_name
+ .byte 37 ; DW_FORM_strx1
+ .byte 0 ; EOM(1)
+ .byte 0 ; EOM(2)
+ .byte 3 ; Abbreviation Code
+ .ascii "\200\204\001" ; DW_TAG_APPLE_property
+ .byte 0 ; DW_CHILDREN_no
+ .ascii "\350\177" ; DW_AT_APPLE_property_name
+ .byte 37 ; DW_FORM_strx1
+ .byte 0 ; EOM(1)
+ .byte 0 ; EOM(2)
+ .byte 4 ; Abbreviation Code
+ .ascii "\200\204\001" ; DW_TAG_APPLE_property
+ .byte 0 ; DW_CHILDREN_no
+ .byte 0 ; EOM(1)
+ .byte 0 ; EOM(2)
+ .byte 5 ; Abbreviation Code
+ .ascii "\200\204\001" ; DW_TAG_APPLE_property
+ .byte 0 ; DW_CHILDREN_no
+ .ascii "\350\177" ; DW_AT_APPLE_property_name
+ .byte 14 ; DW_FORM_strp
+ .byte 0 ; EOM(1)
+ .byte 0 ; EOM(2)
+ .byte 6 ; Abbreviation Code
+ .byte 13 ; DW_TAG_member
+ .byte 0 ; DW_CHILDREN_no
+ .byte 3 ; DW_AT_name
+ .byte 37 ; DW_FORM_strx1
+ .ascii "\355\177" ; DW_AT_APPLE_property
+ .byte 19 ; DW_FORM_ref4
+ .ascii "\355\177" ; DW_AT_APPLE_property
+ .byte 19 ; DW_FORM_ref4
+ .ascii "\355\177" ; DW_AT_APPLE_property
+ .byte 19 ; DW_FORM_ref4
+ .ascii "\355\177" ; DW_AT_APPLE_property
+ .byte 19 ; DW_FORM_ref4
+ .ascii "\355\177" ; DW_AT_APPLE_property
+ .byte 19 ; DW_FORM_ref4
+ .byte 0 ; EOM(1)
+ .byte 0 ; EOM(2)
+ .byte 0 ; EOM(3)
+ .section __DWARF,__debug_info,regular,debug
+Lsection_info:
+Lcu_begin0:
+Lset0 = Ldebug_info_end0-Ldebug_info_start0 ; Length of Unit
+ .long Lset0
+Ldebug_info_start0:
+ .short 5 ; DWARF version number
+ .byte 1 ; DWARF Unit Type
+ .byte 8 ; Address Size (in bytes)
+Lset1 = Lsection_abbrev-Lsection_abbrev ; Offset Into Abbrev. Section
+ .long Lset1
+ .byte 1 ; Abbrev [1] DW_TAG_compile_unit
+Lset2 = Lstr_offsets_base0-Lsection_str_off ; DW_AT_str_offsets_base
+ .long Lset2
+ .byte 2 ; Abbrev [2] DW_TAG_structure_type
+ .byte 2 ; DW_AT_name
+ .byte 3 ; Abbrev [3] DW_TAG_APPLE_property
+ .byte 0 ; DW_AT_APPLE_property_name
+ .byte 4 ; Abbrev [4] DW_TAG_APPLE_property
+ .byte 5 ; Abbrev [5] DW_TAG_APPLE_property
+ .long 102 ; DW_AT_APPLE_property_name
+ .byte 6 ; Abbrev [6] DW_TAG_member
+ .byte 1 ; DW_AT_name
+ .long 19 ; DW_AT_APPLE_property
+ .long 21 ; DW_AT_APPLE_property
+ .long 17 ; DW_AT_APPLE_property
+ .long 0 ; DW_AT_APPLE_property
+ .long 22 ; DW_AT_APPLE_property
+ .byte 0 ; End Of Children Mark
+ .byte 0 ; End Of Children Mark
+Ldebug_info_end0:
+ .section __DWARF,__debug_str_offs,regular,debug
+Lsection_str_off:
+ .long 16 ; Length of String Offsets Set
+ .short 5
+ .short 0
+Lstr_offsets_base0:
+ .section __DWARF,__debug_str,regular,debug
+Linfo_string:
+ .asciz "autoSynthProp" ; string offset=0
+ .asciz "_var" ; string offset=14
+ .asciz "Foo" ; string offset=19
+ .section __DWARF,__debug_str_offs,regular,debug
+ .long 0
+ .long 14
+ .long 19
diff --git a/llvm/test/tools/llvm-readobj/ELF/bb-addr-map-feature-warning.test b/llvm/test/tools/llvm-readobj/ELF/bb-addr-map-feature-warning.test
new file mode 100644
index 0000000..24726c34
--- /dev/null
+++ b/llvm/test/tools/llvm-readobj/ELF/bb-addr-map-feature-warning.test
@@ -0,0 +1,37 @@
+## This test checks that we output a warning when the specified version is too old to support the given features.
+
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-readobj --bb-addr-map %t 2>&1 | FileCheck -DFILE=%t %s
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+
+# CHECK: BBAddrMap [
+# CHECK-NEXT: warning: '[[FILE]]': unable to dump SHT_LLVM_BB_ADDR_MAP section with index 1: version should be >= 3 for SHT_LLVM_BB_ADDR_MAP when callsite offsets feature is enabled: version = 2 feature = 32
+Sections:
+ - Name: '.llvm_bb_addr_map (1)'
+ Type: SHT_LLVM_BB_ADDR_MAP
+ Entries:
+ - Version: 2
+ Feature: 0x20
+
+# CHECK: BBAddrMap [
+# CHECK-NEXT: warning: '[[FILE]]': unable to dump SHT_LLVM_BB_ADDR_MAP section with index 2: version should be >= 4 for SHT_LLVM_BB_ADDR_MAP when basic block hash feature is enabled: version = 3 feature = 64
+
+ - Name: '.llvm_bb_addr_map (2)'
+ Type: SHT_LLVM_BB_ADDR_MAP
+ Entries:
+ - Version: 3
+ Feature: 0x40
+
+# CHECK: BBAddrMap [
+# CHECK-NEXT: warning: '[[FILE]]': unable to dump SHT_LLVM_BB_ADDR_MAP section with index 3: version should be >= 5 for SHT_LLVM_BB_ADDR_MAP when post link cfg feature is enabled: version = 4 feature = 128
+
+ - Name: '.llvm_bb_addr_map (3)'
+ Type: SHT_LLVM_BB_ADDR_MAP
+ Entries:
+ - Version: 4
+ Feature: 0x80
diff --git a/llvm/test/tools/llvm-readobj/ELF/bb-addr-map-pgo-analysis-map.test b/llvm/test/tools/llvm-readobj/ELF/bb-addr-map-pgo-analysis-map.test
index 5faafd4..8e9d227 100644
--- a/llvm/test/tools/llvm-readobj/ELF/bb-addr-map-pgo-analysis-map.test
+++ b/llvm/test/tools/llvm-readobj/ELF/bb-addr-map-pgo-analysis-map.test
@@ -15,7 +15,7 @@
## Check that a malformed section can be handled.
# RUN: yaml2obj %s -DBITS=32 -DSIZE=24 -o %t2.o
-# RUN: llvm-readobj %t2.o --bb-addr-map 2>&1 | FileCheck --match-full-lines %s -DOFFSET=0x00000018 -DFILE=%t2.o --check-prefix=TRUNCATED
+# RUN: llvm-readobj %t2.o --bb-addr-map 2>&1 | FileCheck --match-full-lines %s -DOFFSET=0x00000015 -DFILE=%t2.o --check-prefix=TRUNCATED
## Check that missing features can be handled.
# RUN: yaml2obj %s -DBITS=32 -DFEATURE=0x2 -o %t3.o
@@ -59,17 +59,20 @@
# CHECK-NEXT: {
# RAW-NEXT: Frequency: 100
# PRETTY-NEXT: Frequency: 1.0
+# CHECK-NEXT: PostLink Frequency: 10
# CHECK-NEXT: Successors [
# CHECK-NEXT: {
# CHECK-NEXT: ID: 2
# RAW-NEXT: Probability: 0x80000000
# PRETTY-NEXT: Probability: 0x80000000 / 0x80000000 = 100.00%
+# CHECK-NEXT: PostLink Probability: 7
# CHECK-NEXT: }
# CHECK-NEXT: ]
# CHECK-NEXT: }
# CHECK-NEXT: {
# RAW-NEXT: Frequency: 100
# PRETTY-NEXT: Frequency: 1.0
+# CHECK-NEXT: PostLink Frequency: 0
# CHECK-NEXT: Successors [
# CHECK-NEXT: ]
# CHECK-NEXT: }
@@ -172,8 +175,8 @@ Sections:
ShSize: [[SIZE=<none>]]
Link: .text
Entries:
- - Version: 2
- Feature: 0x7
+ - Version: 5
+ Feature: 0x87
BBRanges:
- BaseAddress: [[ADDR=0x11111]]
BBEntries:
@@ -197,10 +200,12 @@ Sections:
PGOAnalyses:
- FuncEntryCount: 100
PGOBBEntries:
- - BBFreq: 100
+ - BBFreq: 100
+ PostLinkBBFreq: 10
Successors:
- - ID: 2
- BrProb: 0x80000000
+ - ID: 2
+ BrProb: 0x80000000
+ PostLinkBrFreq: 7
- BBFreq: 100
Successors: []
- FuncEntryCount: 8888
diff --git a/llvm/test/tools/obj2yaml/ELF/bb-addr-map-pgo-analysis-map.yaml b/llvm/test/tools/obj2yaml/ELF/bb-addr-map-pgo-analysis-map.yaml
index 299bf46..645507a 100644
--- a/llvm/test/tools/obj2yaml/ELF/bb-addr-map-pgo-analysis-map.yaml
+++ b/llvm/test/tools/obj2yaml/ELF/bb-addr-map-pgo-analysis-map.yaml
@@ -15,7 +15,7 @@
# VALID-NEXT: Type: SHT_LLVM_BB_ADDR_MAP
# VALID-NEXT: Entries:
# VALID-NEXT: - Version: 2
-# VALID-NEXT: Feature: 0x7
+# VALID-NEXT: Feature: 0x87
## The 'BaseAddress' field is omitted when it's zero.
# VALID-NEXT: BBRanges:
# VALID-NEXT: - BBEntries:
@@ -43,17 +43,23 @@
# VALID-NEXT: PGOAnalyses:
# VALID-NEXT: - FuncEntryCount: 100
# VALID-NEXT: PGOBBEntries:
-# VALID-NEXT: - BBFreq: 100
+# VALID-NEXT: - BBFreq: 100
+# VALID-NEXT: PostLinkBBFreq: 10
# VALID-NEXT: Successors:
-# VALID-NEXT: - ID: 2
-# VALID-NEXT: BrProb: 0x80000000
-# VALID-NEXT: - ID: 4
-# VALID-NEXT: BrProb: 0x80000000
-# VALID-NEXT: - BBFreq: 50
+# VALID-NEXT: - ID: 2
+# VALID-NEXT: BrProb: 0x80000000
+# VALID-NEXT: PostLinkBrFreq: 7
+# VALID-NEXT: - ID: 4
+# VALID-NEXT: BrProb: 0x80000000
+# VALID-NEXT: PostLinkBrFreq: 0
+# VALID-NEXT: - BBFreq: 50
+# VALID-NEXT: PostLinkBBFreq: 0
# VALID-NEXT: Successors:
-# VALID-NEXT: - ID: 4
-# VALID-NEXT: BrProb: 0xFFFFFFFF
-# VALID-NEXT: - BBFreq: 100
+# VALID-NEXT: - ID: 4
+# VALID-NEXT: BrProb: 0xFFFFFFFF
+# VALID-NEXT: PostLinkBrFreq: 0
+# VALID-NEXT: - BBFreq: 100
+# VALID-NEXT: PostLinkBBFreq: 3
# VALID-NEXT: Successors: []
# VALID-NEXT: PGOBBEntries:
# VALID-NEXT: - BBFreq: 20
@@ -69,7 +75,7 @@ Sections:
ShSize: [[SIZE=<none>]]
Entries:
- Version: 2
- Feature: 0x7
+ Feature: 0x87
BBRanges:
- BaseAddress: 0x0
BBEntries:
@@ -97,17 +103,20 @@ Sections:
PGOAnalyses:
- FuncEntryCount: 100
PGOBBEntries:
- - BBFreq: 100
+ - BBFreq: 100
+ PostLinkBBFreq: 10
Successors:
- - ID: 2
- BrProb: 0x80000000
- - ID: 4
- BrProb: 0x80000000
- - BBFreq: 50
+ - ID: 2
+ BrProb: 0x80000000
+ PostLinkBrFreq: 7
+ - ID: 4
+ BrProb: 0x80000000
+ - BBFreq: 50
Successors:
- - ID: 4
- BrProb: 0xFFFFFFFF
- - BBFreq: 100
+ - ID: 4
+ BrProb: 0xFFFFFFFF
+ - BBFreq: 100
+ PostLinkBBFreq: 3
Successors: []
- PGOBBEntries:
- BBFreq: 20
diff --git a/llvm/test/tools/yaml2obj/ELF/bb-addr-map-pgo-analysis-map.yaml b/llvm/test/tools/yaml2obj/ELF/bb-addr-map-pgo-analysis-map.yaml
index a4cb572..ac9c8d4 100644
--- a/llvm/test/tools/yaml2obj/ELF/bb-addr-map-pgo-analysis-map.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/bb-addr-map-pgo-analysis-map.yaml
@@ -6,8 +6,9 @@
# Case 4: Specify Entries.
# CHECK: Name: .llvm_bb_addr_map (1)
# CHECK: SectionData (
-# CHECK-NEXT: 0000: 02072000 00000000 0000010B 010203E8
-# CHECK-NEXT: 0010: 07E80702 0CEEDDBB F70E0D91 A2C48801
+# CHECK-NEXT: 0000: 02872000 00000000 0000010B 010203E8
+# CHECK-NEXT: 0010: 07E80764 020CEEDD BBF70E28 0D91A2C4
+# CHECK-NEXT: 0020: 880100
# CHECK-NEXT: )
# Case 7: Not including a field which is enabled in feature doesn't emit value
@@ -26,12 +27,12 @@ Sections:
## Test the following cases:
## 1) We can produce an .llvm_bb_addr_map section from a description with
-## Entries and PGO Analysis data.
+## Entries and PGO Analysis and Post Link data.
- Name: '.llvm_bb_addr_map (1)'
Type: SHT_LLVM_BB_ADDR_MAP
Entries:
- Version: 2
- Feature: 0x7
+ Feature: 0x87
BBRanges:
- BaseAddress: 0x0000000000000020
BBEntries:
@@ -42,12 +43,14 @@ Sections:
PGOAnalyses:
- FuncEntryCount: 1000
PGOBBEntries:
- - BBFreq: 1000
+ - BBFreq: 1000
+ PostLinkBBFreq: 100
Successors:
- - ID: 12
- BrProb: 0xeeeeeeee
- - ID: 13
- BrProb: 0x11111111
+ - ID: 12
+ BrProb: 0xeeeeeeee
+ PostLinkBrFreq: 40
+ - ID: 13
+ BrProb: 0x11111111
## 2) According to feature we have FuncEntryCount but none is provided in yaml
- Name: '.llvm_bb_addr_map (2)'
@@ -66,7 +69,7 @@ Sections:
## Check that yaml2obj generates a warning when we use unsupported feature.
# RUN: yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --check-prefix=INVALID-FEATURE
-# INVALID-FEATURE: warning: invalid encoding for BBAddrMap::Features: 0xf0
+# INVALID-FEATURE: warning: invalid encoding for BBAddrMap::Features: 0x100
--- !ELF
FileHeader:
@@ -79,4 +82,4 @@ Sections:
Entries:
- Version: 2
## Specify unsupported feature
- Feature: 0xF0
+ Feature: 0x100
diff --git a/llvm/test/tools/yaml2obj/ELF/bb-addr-map.yaml b/llvm/test/tools/yaml2obj/ELF/bb-addr-map.yaml
index 339e419..05d77d6 100644
--- a/llvm/test/tools/yaml2obj/ELF/bb-addr-map.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/bb-addr-map.yaml
@@ -220,7 +220,7 @@ Sections:
## Check that yaml2obj generates a warning when we use unsupported versions.
# RUN: yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=INVALID-VERSION
-# INVALID-VERSION: warning: unsupported SHT_LLVM_BB_ADDR_MAP version: 5; encoding using the most recent version
+# INVALID-VERSION: warning: unsupported SHT_LLVM_BB_ADDR_MAP version: 6; encoding using the most recent version
--- !ELF
FileHeader:
@@ -232,4 +232,4 @@ Sections:
Type: SHT_LLVM_BB_ADDR_MAP
Entries:
## Specify unsupported version
- - Version: 5
+ - Version: 6