From d044549557efc225189f2eabba83d2d02ff58ea7 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Tue, 14 Apr 2015 18:33:00 +0000 Subject: [PATCH] IR: Set -preserve-bc-uselistorder=false by default But keep it on by default in `llvm-as`, `opt`, `bugpoint`, `llvm-link`, `llvm-extract`, and `LTOCodeGenerator`. Part of PR5680. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234921 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/UseListOrder.cpp | 2 +- lib/LTO/LTOCodeGenerator.cpp | 5 +++++ tools/bugpoint/bugpoint.cpp | 5 +++++ tools/llvm-as/llvm-as.cpp | 6 ++++++ tools/llvm-extract/llvm-extract.cpp | 6 ++++++ tools/llvm-link/llvm-link.cpp | 6 ++++++ tools/opt/opt.cpp | 5 +++++ 7 files changed, 34 insertions(+), 1 deletion(-) diff --git a/lib/IR/UseListOrder.cpp b/lib/IR/UseListOrder.cpp index 801c71de5ed..2bc29f2b95c 100644 --- a/lib/IR/UseListOrder.cpp +++ b/lib/IR/UseListOrder.cpp @@ -19,7 +19,7 @@ using namespace llvm; static cl::opt PreserveBitcodeUseListOrder( "preserve-bc-uselistorder", cl::desc("Preserve use-list order when writing LLVM bitcode."), - cl::init(true), cl::Hidden); + cl::init(false), cl::Hidden); static cl::opt PreserveAssemblyUseListOrder( "preserve-ll-uselistorder", diff --git a/lib/LTO/LTOCodeGenerator.cpp b/lib/LTO/LTOCodeGenerator.cpp index 2bcdc27e965..345b2246388 100644 --- a/lib/LTO/LTOCodeGenerator.cpp +++ b/lib/LTO/LTOCodeGenerator.cpp @@ -29,6 +29,7 @@ #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/Mangler.h" #include "llvm/IR/Module.h" +#include "llvm/IR/UseListOrder.h" #include "llvm/IR/Verifier.h" #include "llvm/InitializePasses.h" #include "llvm/LTO/LTOModule.h" @@ -603,6 +604,10 @@ void LTOCodeGenerator::setCodeGenDebugOptions(const char *options) { } void LTOCodeGenerator::parseCodeGenDebugOptions() { + // Turn on -preserve-bc-uselistorder by default, but let the command-line + // override it. + setPreserveBitcodeUseListOrder(true); + // if options were requested, set them if (!CodegenOptions.empty()) cl::ParseCommandLineOptions(CodegenOptions.size(), diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp index 0ee3784660a..bb790675d75 100644 --- a/tools/bugpoint/bugpoint.cpp +++ b/tools/bugpoint/bugpoint.cpp @@ -18,6 +18,7 @@ #include "llvm/IR/LLVMContext.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/LegacyPassNameParser.h" +#include "llvm/IR/UseListOrder.h" #include "llvm/LinkAllIR.h" #include "llvm/LinkAllPasses.h" #include "llvm/Support/CommandLine.h" @@ -136,6 +137,10 @@ int main(int argc, char **argv) { polly::initializePollyPasses(Registry); #endif + // Turn on -preserve-bc-uselistorder by default, but let the command-line + // override it. + setPreserveBitcodeUseListOrder(true); + cl::ParseCommandLineOptions(argc, argv, "LLVM automatic testcase reducer. See\nhttp://" "llvm.org/cmds/bugpoint.html" diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index 5ccf505923f..ae8ca569fd4 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -19,6 +19,7 @@ #include "llvm/AsmParser/Parser.h" #include "llvm/Bitcode/ReaderWriter.h" #include "llvm/IR/Module.h" +#include "llvm/IR/UseListOrder.h" #include "llvm/IR/Verifier.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" @@ -90,6 +91,11 @@ int main(int argc, char **argv) { PrettyStackTraceProgram X(argc, argv); LLVMContext &Context = getGlobalContext(); llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. + + // Turn on -preserve-bc-uselistorder by default, but let the command-line + // override it. + setPreserveBitcodeUseListOrder(true); + cl::ParseCommandLineOptions(argc, argv, "llvm .ll -> .bc assembler\n"); // Parse the file now... diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp index 8bfd3197fdc..443ee653c8e 100644 --- a/tools/llvm-extract/llvm-extract.cpp +++ b/tools/llvm-extract/llvm-extract.cpp @@ -19,6 +19,7 @@ #include "llvm/IR/IRPrintingPasses.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" +#include "llvm/IR/UseListOrder.h" #include "llvm/IRReader/IRReader.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/Support/CommandLine.h" @@ -97,6 +98,11 @@ int main(int argc, char **argv) { LLVMContext &Context = getGlobalContext(); llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. + + // Turn on -preserve-bc-uselistorder by default, but let the command-line + // override it. + setPreserveBitcodeUseListOrder(true); + cl::ParseCommandLineOptions(argc, argv, "llvm extractor\n"); // Use lazy loading, since we only care about selected global values. diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index 6924aa5cb2e..5f1dccb378a 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -20,6 +20,7 @@ #include "llvm/IR/DiagnosticPrinter.h" #include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" +#include "llvm/IR/UseListOrder.h" #include "llvm/IR/Verifier.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Support/CommandLine.h" @@ -104,6 +105,11 @@ int main(int argc, char **argv) { LLVMContext &Context = getGlobalContext(); llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. + + // Turn on -preserve-bc-uselistorder by default, but let the command-line + // override it. + setPreserveBitcodeUseListOrder(true); + cl::ParseCommandLineOptions(argc, argv, "llvm linker\n"); auto Composite = make_unique("llvm-link", Context); diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index af86e2dbd60..b0951a4887e 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -30,6 +30,7 @@ #include "llvm/IR/LLVMContext.h" #include "llvm/IR/LegacyPassNameParser.h" #include "llvm/IR/Module.h" +#include "llvm/IR/UseListOrder.h" #include "llvm/IR/Verifier.h" #include "llvm/IRReader/IRReader.h" #include "llvm/InitializePasses.h" @@ -344,6 +345,10 @@ int main(int argc, char **argv) { polly::initializePollyPasses(Registry); #endif + // Turn on -preserve-bc-uselistorder by default, but let the command-line + // override it. + setPreserveBitcodeUseListOrder(true); + cl::ParseCommandLineOptions(argc, argv, "llvm .bc -> .bc modular optimizer and analysis printer\n"); -- 2.34.1