From 26eca2439c664c648c4e293c68c18c2d6e7d7855 Mon Sep 17 00:00:00 2001 From: Mingjie Xu Date: Sat, 11 Oct 2025 09:19:50 +0800 Subject: 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. --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp') 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 #endif cl::desc("")); +static cl::opt 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). -- cgit v1.1