204 lines · yaml
1## Test that in the presence of SHT_LLVM_BB_ADDR_MAP sections which also2## contain PGO data, --symbolize-operands is able to label the basic blocks3## correctly.4 5## Check the case where we only have entry counts.6 7# RUN: yaml2obj --docnum=1 %s -o %t18# RUN: llvm-objdump %t1 -d --symbolize-operands --no-show-raw-insn --no-leading-addr | \9# RUN: FileCheck %s --check-prefix=ENTRYCOUNT10 11--- !ELF12FileHeader:13 Class: ELFCLASS6414 Data: ELFDATA2LSB15 Type: ET_EXEC16 Machine: EM_X86_6417Sections:18 - Name: .text.foo19 Type: SHT_PROGBITS20 Address: 0x021 Flags: [SHF_ALLOC, SHF_EXECINSTR]22 Content: '50'23 - Name: .llvm_bb_addr_map.foo24 Type: SHT_LLVM_BB_ADDR_MAP25 Link: .text.foo26 Entries:27 - Version: 228 Feature: 0x129 BBRanges:30 - BaseAddress: 0x031 BBEntries:32 - ID: 333 AddressOffset: 0x034 Size: 0x135 Metadata: 0x136 PGOAnalyses:37 - FuncEntryCount: 100038Symbols:39 - Name: foo40 Section: .text.foo41 Value: 0x042 43# ENTRYCOUNT: <foo>:44# ENTRYCOUNT: <BB3> (Entry count: 1000):45 46## Check the case where we have entry points and block frequency information47 48# RUN: yaml2obj %s --docnum=2 -o %t249# RUN: llvm-objdump %t2 -d --symbolize-operands --no-show-raw-insn --no-leading-addr | \50# RUN: FileCheck --match-full-lines --strict-whitespace %s --check-prefix=ENTRYCOUNT-BLOCKFREQ51# RUN: llvm-objdump %t2 -d --symbolize-operands --pretty-pgo-analysis-map --no-show-raw-insn --no-leading-addr | \52# RUN: FileCheck --match-full-lines --strict-whitespace %s --check-prefix=ENTRYCOUNT-BLOCKFREQ-PRETTY53 54--- !ELF55FileHeader:56 Class: ELFCLASS6457 Data: ELFDATA2LSB58 Type: ET_EXEC59 Machine: EM_X86_6460Sections:61 - Name: .text.foo62 Type: SHT_PROGBITS63 Address: 0x064 Flags: [SHF_ALLOC, SHF_EXECINSTR]65 Content: '503b0505200000907d02ebf5c3'66 - Name: .llvm_bb_addr_map.foo67 Type: SHT_LLVM_BB_ADDR_MAP68 Link: .text.foo69 Entries:70 - Version: 271 Feature: 0x372 BBRanges:73 - BaseAddress: 0x074 BBEntries:75 - ID: 376 AddressOffset: 0x077 Size: 0x178 Metadata: 0x179 - ID: 180 AddressOffset: 0x081 Size: 0x682 Metadata: 0x083 - ID: 284 AddressOffset: 0x185 Size: 0x486 Metadata: 0x087 - ID: 588 AddressOffset: 0x089 Size: 0x190 Metadata: 0x291 PGOAnalyses:92 - FuncEntryCount: 100093 PGOBBEntries:94 - BBFreq: 100095 - BBFreq: 13396 - BBFreq: 1897 - BBFreq: 100098Symbols:99 - Name: foo100 Section: .text.foo101 Value: 0x0102 103# ENTRYCOUNT-BLOCKFREQ:<foo>:104# ENTRYCOUNT-BLOCKFREQ:<BB3> (Entry count: 1000, Frequency: 1000):105# ENTRYCOUNT-BLOCKFREQ:<BB1> (Frequency: 133):106# ENTRYCOUNT-BLOCKFREQ:<BB2> (Frequency: 18):107# ENTRYCOUNT-BLOCKFREQ:<BB5> (Frequency: 1000):108 109# ENTRYCOUNT-BLOCKFREQ-PRETTY:<foo>:110# ENTRYCOUNT-BLOCKFREQ-PRETTY:<BB3> (Entry count: 1000, Frequency: 1.0):111# ENTRYCOUNT-BLOCKFREQ-PRETTY:<BB1> (Frequency: 0.133):112# ENTRYCOUNT-BLOCKFREQ-PRETTY:<BB2> (Frequency: 0.018):113# ENTRYCOUNT-BLOCKFREQ-PRETTY:<BB5> (Frequency: 1.0):114 115## Check the case where we have entry points, block frequency, and branch116## proabability information.117 118# RUN: yaml2obj %s --docnum=3 -o %t3119# RUN: llvm-objdump %t3 -d --symbolize-operands --no-show-raw-insn --no-leading-addr | \120# RUN: FileCheck --match-full-lines --strict-whitespace %s --check-prefix=ENTRY-FREQ-PROB121# RUN: llvm-objdump %t3 -d --symbolize-operands --pretty-pgo-analysis-map --no-show-raw-insn --no-leading-addr | \122# RUN: FileCheck --match-full-lines --strict-whitespace %s --check-prefix=ENTRY-FREQ-PROB-PRETTY123# RUN: llvm-objdump %t3 -d --pretty-pgo-analysis-map --no-show-raw-insn --no-leading-addr 2>&1 | \124# RUN: FileCheck %s --check-prefix=MISSING-SYMBOLIZE-OPERANDS125 126--- !ELF127FileHeader:128 Class: ELFCLASS64129 Data: ELFDATA2LSB130 Type: ET_EXEC131 Machine: EM_X86_64132Sections:133 - Name: .text.foo134 Type: SHT_PROGBITS135 Address: 0x0136 Flags: [SHF_ALLOC, SHF_EXECINSTR]137 Content: '503b0505200000907d02ebf5c3'138 - Name: .llvm_bb_addr_map.foo139 Type: SHT_LLVM_BB_ADDR_MAP140 Link: .text.foo141 Entries:142 - Version: 2143 Feature: 0x7144 BBRanges:145 - BaseAddress: 0x0146 BBEntries:147 - ID: 3148 AddressOffset: 0x0149 Size: 0x1150 Metadata: 0x1151 - ID: 1152 AddressOffset: 0x0153 Size: 0x6154 Metadata: 0x0155 - ID: 2156 AddressOffset: 0x1157 Size: 0x4158 Metadata: 0x0159 - ID: 5160 AddressOffset: 0x0161 Size: 0x1162 Metadata: 0x2163 PGOAnalyses:164 - FuncEntryCount: 1000165 PGOBBEntries:166 - BBFreq: 1000167 Successors:168 - ID: 1169 BrProb: 0x10000000170 - ID: 2171 BrProb: 0x15000000172 - ID: 3173 BrProb: 0x50000000174 - BBFreq: 133175 Successors:176 - ID: 2177 BrProb: 0x10000000178 - ID: 3179 BrProb: 0x70000000180 - BBFreq: 18181 Successors:182 - ID: 3183 BrProb: 0x80000000184 - BBFreq: 1000185 Successors: []186Symbols:187 - Name: foo188 Section: .text.foo189 Value: 0x0190 191# ENTRY-FREQ-PROB:<foo>:192# ENTRY-FREQ-PROB:<BB3> (Entry count: 1000, Frequency: 1000, Successors: BB1:10000000, BB2:15000000, BB3:50000000):193# ENTRY-FREQ-PROB:<BB1> (Frequency: 133, Successors: BB2:10000000, BB3:70000000):194# ENTRY-FREQ-PROB:<BB2> (Frequency: 18, Successors: BB3:80000000):195# ENTRY-FREQ-PROB:<BB5> (Frequency: 1000):196 197# ENTRY-FREQ-PROB-PRETTY:<foo>:198# ENTRY-FREQ-PROB-PRETTY:<BB3> (Entry count: 1000, Frequency: 1.0, Successors: BB1:[0x10000000 / 0x80000000 = 12.50%], BB2:[0x15000000 / 0x80000000 = 16.41%], BB3:[0x50000000 / 0x80000000 = 62.50%]):199# ENTRY-FREQ-PROB-PRETTY:<BB1> (Frequency: 0.133, Successors: BB2:[0x10000000 / 0x80000000 = 12.50%], BB3:[0x70000000 / 0x80000000 = 87.50%]):200# ENTRY-FREQ-PROB-PRETTY:<BB2> (Frequency: 0.018, Successors: BB3:[0x80000000 / 0x80000000 = 100.00%]):201# ENTRY-FREQ-PROB-PRETTY:<BB5> (Frequency: 1.0):202 203# MISSING-SYMBOLIZE-OPERANDS: warning: --symbolize-operands must be enabled for --pretty-pgo-analysis-map to have an effect204