diff options
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 10 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/basic-block-address-map-pgo-features.ll | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 2d444f2..4ea71c9 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1371,6 +1371,16 @@ static uint32_t getBBAddrMapMetadata(const MachineBasicBlock &MBB) { static llvm::object::BBAddrMap::Features getBBAddrMapFeature(const MachineFunction &MF, int NumMBBSectionRanges) { + // Ensure that the user has not passed in additional options while also + // specifying all or none. + if ((PgoAnalysisMapFeatures.isSet(PGOMapFeaturesEnum::None) || + PgoAnalysisMapFeatures.isSet(PGOMapFeaturesEnum::All)) && + popcount(PgoAnalysisMapFeatures.getBits()) != 1) { + MF.getFunction().getContext().emitError( + "-pgo-anaylsis-map can accept only all or none with no additional " + "values."); + } + bool NoFeatures = PgoAnalysisMapFeatures.isSet(PGOMapFeaturesEnum::None); bool AllFeatures = PgoAnalysisMapFeatures.isSet(PGOMapFeaturesEnum::All); bool FuncEntryCountEnabled = diff --git a/llvm/test/CodeGen/X86/basic-block-address-map-pgo-features.ll b/llvm/test/CodeGen/X86/basic-block-address-map-pgo-features.ll index 1c3db73..fca5aa0 100644 --- a/llvm/test/CodeGen/X86/basic-block-address-map-pgo-features.ll +++ b/llvm/test/CodeGen/X86/basic-block-address-map-pgo-features.ll @@ -11,6 +11,10 @@ ; RUN: llc < %s -mtriple=x86_64 -function-sections -unique-section-names=true -basic-block-address-map -pgo-analysis-map=bb-freq | FileCheck %s --check-prefixes=CHECK,PGO-BBF,BBF-ONLY ; 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 +;; Verify that we emit an error if we try and specify values in addition to all/none +; RUN: not llc < %s -mtriple=x86_64 -basic-block-address-map -pgo-analysis-map=all,bb-freq +; RUN: not llc < %s -mtriple=x86_64 -basic-block-address-map -pgo-analysis-map=none,bb-freq + define void @_Z3bazb(i1 zeroext, i1 zeroext) personality ptr @__gxx_personality_v0 !prof !0 { br i1 %0, label %3, label %8, !prof !1 |