diff options
author | Mingjie Xu <xumingjie.enna1@bytedance.com> | 2025-10-11 09:19:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-11 09:19:50 +0800 |
commit | 26eca2439c664c648c4e293c68c18c2d6e7d7855 (patch) | |
tree | f46f1e363671368f10e39184c566ed7defc90bd6 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 19b9b54158b9d4653e26f02981e43b6f45048e55 (diff) | |
download | llvm-26eca2439c664c648c4e293c68c18c2d6e7d7855.zip llvm-26eca2439c664c648c4e293c68c18c2d6e7d7855.tar.gz llvm-26eca2439c664c648c4e293c68c18c2d6e7d7855.tar.bz2 |
Move the preserve-{bc,ll}-uselistorder options out of individual tools, make them global defaults for AsmWriter and BitcodeWriter (#160079)
This patch moves the `preserve-bc-uselistorder` and
`preserve-ll-uselistorder` options out of individual tools(opt, llvm-as,
llvm-dis, llvm-link, llvm-extract) and make them global defaults for
AsmWriter and BitcodeWriter.
These options are useful when we use `-print-*` options to dump LLVM IR.
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 0ca55a26..54e916e 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -118,6 +118,10 @@ static cl::opt<bool> #endif cl::desc("")); +static cl::opt<bool> PreserveBitcodeUseListOrder( + "preserve-bc-uselistorder", cl::Hidden, cl::init(true), + cl::desc("Preserve use-list order when writing LLVM bitcode.")); + namespace llvm { extern FunctionSummary::ForceSummaryHotnessType ForceSummaryEdgesCold; } @@ -217,7 +221,10 @@ public: bool ShouldPreserveUseListOrder, const ModuleSummaryIndex *Index) : BitcodeWriterBase(Stream, StrtabBuilder), M(M), - VE(M, ShouldPreserveUseListOrder), Index(Index) { + VE(M, PreserveBitcodeUseListOrder.getNumOccurrences() + ? PreserveBitcodeUseListOrder + : ShouldPreserveUseListOrder), + Index(Index) { // Assign ValueIds to any callee values in the index that came from // indirect call profiles and were recorded as a GUID not a Value* // (which would have been assigned an ID by the ValueEnumerator). |