[llvm] Move the preserve-{bc,ll}-uselistorder options out of individual tools, make them global defaults for AsmWriter and BitcodeWriter (PR #160079)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 23 02:46:34 PDT 2025


================
@@ -118,6 +118,11 @@ static cl::opt<bool>
 #endif
                                 cl::desc(""));
 
+static cl::opt<bool> PreserveBitcodeUseListOrder(
+    "preserve-bc-uselistorder",
+    cl::desc("Preserve use-list order when writing LLVM bitcode."),
+    cl::init(false), cl::Hidden);
----------------
nikic wrote:

But this makes it effectively impossible to set `-preserve-bc-uselistorder=0`, as the explicit argument will take precedence.

I think the way this needs to work is that the argument is a `std::optional<bool>` where true/false forces one or the other and nullopt makes it use the option.

https://github.com/llvm/llvm-project/pull/160079


More information about the llvm-commits mailing list