Skip to content

Commit 37c2c3d

Browse files
committed
addressing comment, fix test
1 parent 339f727 commit 37c2c3d

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

llvm/lib/Object/ELF.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,6 @@ decodeBBAddrMapImpl(const ELFFile<ELFT> &EF,
823823
uint32_t NumBlocksInBBRange = 0;
824824
uint32_t NumBBRanges = 1;
825825
typename ELFFile<ELFT>::uintX_t RangeBaseAddress = 0;
826-
uint32_t TotalNumBlocks = 0;
827826
if (FeatEnable.MultiBBRange) {
828827
NumBBRanges = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
829828
if (!Cur || ULEBSizeErr)
@@ -839,6 +838,7 @@ decodeBBAddrMapImpl(const ELFFile<ELFT> &EF,
839838
RangeBaseAddress = *AddressOrErr;
840839
NumBlocksInBBRange = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
841840
}
841+
uint32_t TotalNumBlocks = 0;
842842
std::vector<BBAddrMap::BBRangeEntry> BBRangeEntries;
843843
for (uint32_t BBRangeIndex = 0; BBRangeIndex < NumBBRanges;
844844
++BBRangeIndex) {
@@ -866,6 +866,13 @@ decodeBBAddrMapImpl(const ELFFile<ELFT> &EF,
866866
Offset += PrevBBEndOffset;
867867
PrevBBEndOffset = Offset + Size;
868868
}
869+
Expected<BBAddrMap::BBEntry::Metadata> MetadataOrErr =
870+
BBAddrMap::BBEntry::Metadata::decode(MD);
871+
if (!MetadataOrErr) {
872+
MetadataDecodeErr = MetadataOrErr.takeError();
873+
break;
874+
}
875+
BBEntries.push_back({ID, Offset, Size, *MetadataOrErr});
869876
}
870877
TotalNumBlocks += BBEntries.size();
871878
}

llvm/test/CodeGen/X86/basic-block-address-map-pgo-features.ll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=br-prob | FileCheck %s --check-prefixes=CHECK,PGO-BRP,BRP-ONLY
1313

1414
; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=func-entry-count -basic-block-address-map-skip-bb-entries | FileCheck %s --check-prefixes=SKIP-BB-ENTRIES
15-
; RUN: not llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=bb-freq -basic-block-address-map-skip-bb-entries
16-
; RUN: not llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=br-prob -basic-block-address-map-skip-bb-entries
15+
; RUN: not llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=bb-freq -basic-block-address-map-skip-bb-entries 2>&1 | FileCheck %s --check-prefixes=SKIP-BB-ENTRIES-ERROR
16+
; RUN: not llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=br-prob -basic-block-address-map-skip-bb-entries 2>&1 | FileCheck %s --check-prefixes=SKIP-BB-ENTRIES-ERROR
1717

1818
;; Verify that we emit an error if we try and specify values in addition to all/none
1919
; RUN: not llc < %s -mtriple=x86_64 -basic-block-address-map -pgo-analysis-map=all,bb-freq
@@ -138,9 +138,10 @@ declare i32 @__gxx_personality_v0(...)
138138
; PGO-BRP-NEXT: .byte 5 # successor BB ID
139139
; PGO-BRP-NEXT: .ascii "\200\200\200\200\b" # successor branch probability
140140

141-
142141
; SKIP-BB-ENTRIES: .byte 17 # feature
143142
; SKIP-BB-ENTRIES-NEXT: .quad .Lfunc_begin0 # function address
144143
; SKIP-BB-ENTRIES-NEXT: .byte 6 # number of basic blocks
145144
; SKIP-BB-ENTRIES-NEXT: .byte 100 # function entry count
146145
; SKIP-BB-ENTRIES-NOT: # BB id
146+
147+
; SKIP-BB-ENTRIES-ERROR: error: BB entries info is required for BBFreq and BrProb features

llvm/test/tools/llvm-readobj/ELF/bb-addr-map-skip-bb-entries.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## This test checks how llvm-readobj prints for skipped BB entries(-skip-emit-bb-entries) file.
1+
## This test checks how llvm-readobj prints for skipped BB entries(-basic-block-address-map-skip-emit-bb-entries) file.
22

33
## Check 64-bit:
44
# RUN: yaml2obj %s -DBITS=64 -o %t1.x64.o

0 commit comments

Comments
 (0)