[llvm] r234973 - uselistorder: Remove the global bits
Duncan P. N. Exon Smith
dexonsmith at apple.com
Tue Apr 14 20:30:54 PDT 2015
> On 2015-Apr-14, at 20:29, David Blaikie <dblaikie at gmail.com> wrote:
>
> On Tue, Apr 14, 2015 at 8:25 PM, Duncan P. N. Exon Smith
> <dexonsmith at apple.com> wrote:
>>
>>> On 2015-Apr-14, at 20:22, David Blaikie <dblaikie at gmail.com> wrote:
>>>
>>> On Tue, Apr 14, 2015 at 8:14 PM, Duncan P. N. Exon Smith
>>> <dexonsmith at apple.com> wrote:
>>>> Author: dexonsmith
>>>> Date: Tue Apr 14 22:14:06 2015
>>>> New Revision: 234973
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=234973&view=rev
>>>> Log:
>>>> uselistorder: Remove the global bits
>>>>
>>>> Remove all the global bits to do with preserving use-list order by
>>>> moving the `cl::opt`s to the individual tools that want them.
>>>
>>> Awesome!
>>>
>>>> There's a
>>>> minor functionality change to `libLTO`, in that you can't send in
>>>> `-preserve-bc-uselistorder=false`, but making that bit settable (if it's
>>>> worth doing) should be through explicit LTO API.
>>>
>>> So the default in libLTO is to preserve? Shouldn't it be the old
>>> non-preserving behavior? (sorry, perhaps I'm missing something with
>>> all this - don't know which users we have, etc)
>>
>> IMO, bitcode output of LTO is debug output. (But let's keep this
>> conversation in the other thread.)
>
> Sure, sorry, wasn't sure if these were the same bit of things.
My fault, I should have been more clear in the commit message that
"whether this should be settable" is still under review.
>
>>
>>>
>>>> As a drive-by fix, I removed some includes of `UseListOrder.h` that were
>>>> made unnecessary by recent commits.
>>>>
>>>> Removed:
>>>> llvm/trunk/lib/IR/UseListOrder.cpp
>>>> Modified:
>>>> llvm/trunk/include/llvm/IR/UseListOrder.h
>>>> llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp
>>>> llvm/trunk/lib/IR/CMakeLists.txt
>>>> llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
>>>> llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
>>>> llvm/trunk/tools/bugpoint/bugpoint.cpp
>>>> llvm/trunk/tools/llvm-as/llvm-as.cpp
>>>> llvm/trunk/tools/llvm-dis/llvm-dis.cpp
>>>> llvm/trunk/tools/llvm-extract/llvm-extract.cpp
>>>> llvm/trunk/tools/llvm-link/llvm-link.cpp
>>>> llvm/trunk/tools/opt/opt.cpp
>>>>
>>>> Modified: llvm/trunk/include/llvm/IR/UseListOrder.h
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/UseListOrder.h?rev=234973&r1=234972&r2=234973&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/include/llvm/IR/UseListOrder.h (original)
>>>> +++ llvm/trunk/include/llvm/IR/UseListOrder.h Tue Apr 14 22:14:06 2015
>>>> @@ -51,12 +51,6 @@ private:
>>>>
>>>> typedef std::vector<UseListOrder> UseListOrderStack;
>>>>
>>>> -/// \brief Whether to preserve use-list ordering.
>>>> -bool shouldPreserveBitcodeUseListOrder();
>>>> -bool shouldPreserveAssemblyUseListOrder();
>>>> -void setPreserveBitcodeUseListOrder(bool ShouldPreserve);
>>>> -void setPreserveAssemblyUseListOrder(bool ShouldPreserve);
>>>> -
>>>> } // end namespace llvm
>>>>
>>>> #endif
>>>>
>>>> Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp?rev=234973&r1=234972&r2=234973&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp (original)
>>>> +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp Tue Apr 14 22:14:06 2015
>>>> @@ -15,7 +15,6 @@
>>>> #include "llvm/Bitcode/ReaderWriter.h"
>>>> #include "llvm/IR/Module.h"
>>>> #include "llvm/IR/PassManager.h"
>>>> -#include "llvm/IR/UseListOrder.h"
>>>> #include "llvm/Pass.h"
>>>> using namespace llvm;
>>>>
>>>>
>>>> Modified: llvm/trunk/lib/IR/CMakeLists.txt
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/CMakeLists.txt?rev=234973&r1=234972&r2=234973&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/IR/CMakeLists.txt (original)
>>>> +++ llvm/trunk/lib/IR/CMakeLists.txt Tue Apr 14 22:14:06 2015
>>>> @@ -41,7 +41,6 @@ add_llvm_library(LLVMCore
>>>> Type.cpp
>>>> TypeFinder.cpp
>>>> Use.cpp
>>>> - UseListOrder.cpp
>>>> User.cpp
>>>> Value.cpp
>>>> ValueSymbolTable.cpp
>>>>
>>>> Removed: llvm/trunk/lib/IR/UseListOrder.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/UseListOrder.cpp?rev=234972&view=auto
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/IR/UseListOrder.cpp (original)
>>>> +++ llvm/trunk/lib/IR/UseListOrder.cpp (removed)
>>>> @@ -1,43 +0,0 @@
>>>> -//===- UseListOrder.cpp - Implement Use List Order ------------------------===//
>>>> -//
>>>> -// The LLVM Compiler Infrastructure
>>>> -//
>>>> -// This file is distributed under the University of Illinois Open Source
>>>> -// License. See LICENSE.TXT for details.
>>>> -//
>>>> -//===----------------------------------------------------------------------===//
>>>> -//
>>>> -// Implement structures and command-line options for preserving use-list order.
>>>> -//
>>>> -//===----------------------------------------------------------------------===//
>>>> -
>>>> -#include "llvm/IR/UseListOrder.h"
>>>> -#include "llvm/Support/CommandLine.h"
>>>> -
>>>> -using namespace llvm;
>>>> -
>>>> -static cl::opt<bool> PreserveBitcodeUseListOrder(
>>>> - "preserve-bc-uselistorder",
>>>> - cl::desc("Preserve use-list order when writing LLVM bitcode."),
>>>> - cl::init(false), cl::Hidden);
>>>> -
>>>> -static cl::opt<bool> PreserveAssemblyUseListOrder(
>>>> - "preserve-ll-uselistorder",
>>>> - cl::desc("Preserve use-list order when writing LLVM assembly."),
>>>> - cl::init(false), cl::Hidden);
>>>> -
>>>> -bool llvm::shouldPreserveBitcodeUseListOrder() {
>>>> - return PreserveBitcodeUseListOrder;
>>>> -}
>>>> -
>>>> -bool llvm::shouldPreserveAssemblyUseListOrder() {
>>>> - return PreserveAssemblyUseListOrder;
>>>> -}
>>>> -
>>>> -void llvm::setPreserveBitcodeUseListOrder(bool ShouldPreserve) {
>>>> - PreserveBitcodeUseListOrder = ShouldPreserve;
>>>> -}
>>>> -
>>>> -void llvm::setPreserveAssemblyUseListOrder(bool ShouldPreserve) {
>>>> - PreserveAssemblyUseListOrder = ShouldPreserve;
>>>> -}
>>>>
>>>> Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=234973&r1=234972&r2=234973&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
>>>> +++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Tue Apr 14 22:14:06 2015
>>>> @@ -29,7 +29,6 @@
>>>> #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"
>>>> @@ -216,7 +215,7 @@ bool LTOCodeGenerator::writeMergedModule
>>>>
>>>> // write bitcode to it
>>>> WriteBitcodeToFile(IRLinker.getModule(), Out.os(),
>>>> - shouldPreserveBitcodeUseListOrder());
>>>> + /* ShouldPreserveUseListOrder */ true);
>>>> Out.os().close();
>>>>
>>>> if (Out.os().has_error()) {
>>>> @@ -606,10 +605,6 @@ void LTOCodeGenerator::setCodeGenDebugOp
>>>> }
>>>>
>>>> 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(),
>>>>
>>>> Modified: llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/OptimizerDriver.cpp?rev=234973&r1=234972&r2=234973&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/tools/bugpoint/OptimizerDriver.cpp (original)
>>>> +++ llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Tue Apr 14 22:14:06 2015
>>>> @@ -20,7 +20,6 @@
>>>> #include "llvm/IR/DataLayout.h"
>>>> #include "llvm/IR/LegacyPassManager.h"
>>>> #include "llvm/IR/Module.h"
>>>> -#include "llvm/IR/UseListOrder.h"
>>>> #include "llvm/IR/Verifier.h"
>>>> #include "llvm/Support/CommandLine.h"
>>>> #include "llvm/Support/Debug.h"
>>>> @@ -43,6 +42,11 @@ namespace llvm {
>>>> extern cl::opt<std::string> OutputPrefix;
>>>> }
>>>>
>>>> +static cl::opt<bool> PreserveBitcodeUseListOrder(
>>>> + "preserve-bc-uselistorder",
>>>> + cl::desc("Preserve use-list order when writing LLVM bitcode."),
>>>> + cl::init(true), cl::Hidden);
>>>> +
>>>> namespace {
>>>> // ChildOutput - This option captures the name of the child output file that
>>>> // is set up by the parent bugpoint process
>>>> @@ -56,7 +60,7 @@ namespace {
>>>> /// file. If an error occurs, true is returned.
>>>> ///
>>>> static bool writeProgramToFileAux(tool_output_file &Out, const Module *M) {
>>>> - WriteBitcodeToFile(M, Out.os(), shouldPreserveBitcodeUseListOrder());
>>>> + WriteBitcodeToFile(M, Out.os(), PreserveBitcodeUseListOrder);
>>>> Out.os().close();
>>>> if (!Out.os().has_error()) {
>>>> Out.keep();
>>>> @@ -152,7 +156,7 @@ bool BugDriver::runPasses(Module *Progra
>>>>
>>>> tool_output_file InFile(InputFilename, InputFD);
>>>>
>>>> - WriteBitcodeToFile(Program, InFile.os(), shouldPreserveBitcodeUseListOrder());
>>>> + WriteBitcodeToFile(Program, InFile.os(), PreserveBitcodeUseListOrder);
>>>> InFile.os().close();
>>>> if (InFile.os().has_error()) {
>>>> errs() << "Error writing bitcode file: " << InputFilename << "\n";
>>>>
>>>> Modified: llvm/trunk/tools/bugpoint/bugpoint.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=234973&r1=234972&r2=234973&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/tools/bugpoint/bugpoint.cpp (original)
>>>> +++ llvm/trunk/tools/bugpoint/bugpoint.cpp Tue Apr 14 22:14:06 2015
>>>> @@ -18,7 +18,6 @@
>>>> #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"
>>>> @@ -137,10 +136,6 @@ 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"
>>>>
>>>> Modified: llvm/trunk/tools/llvm-as/llvm-as.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/llvm-as.cpp?rev=234973&r1=234972&r2=234973&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/tools/llvm-as/llvm-as.cpp (original)
>>>> +++ llvm/trunk/tools/llvm-as/llvm-as.cpp Tue Apr 14 22:14:06 2015
>>>> @@ -19,7 +19,6 @@
>>>> #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"
>>>> @@ -52,6 +51,11 @@ static cl::opt<bool>
>>>> DisableVerify("disable-verify", cl::Hidden,
>>>> cl::desc("Do not run verifier on input LLVM (dangerous!)"));
>>>>
>>>> +static cl::opt<bool> PreserveBitcodeUseListOrder(
>>>> + "preserve-bc-uselistorder",
>>>> + cl::desc("Preserve use-list order when writing LLVM bitcode."),
>>>> + cl::init(true), cl::Hidden);
>>>> +
>>>> static void WriteOutputFile(const Module *M) {
>>>> // Infer the output filename if needed.
>>>> if (OutputFilename.empty()) {
>>>> @@ -79,7 +83,7 @@ static void WriteOutputFile(const Module
>>>> }
>>>>
>>>> if (Force || !CheckBitcodeOutputToConsole(Out->os(), true))
>>>> - WriteBitcodeToFile(M, Out->os(), shouldPreserveBitcodeUseListOrder());
>>>> + WriteBitcodeToFile(M, Out->os(), PreserveBitcodeUseListOrder);
>>>>
>>>> // Declare success.
>>>> Out->keep();
>>>> @@ -91,11 +95,6 @@ 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...
>>>>
>>>> Modified: llvm/trunk/tools/llvm-dis/llvm-dis.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dis/llvm-dis.cpp?rev=234973&r1=234972&r2=234973&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/tools/llvm-dis/llvm-dis.cpp (original)
>>>> +++ llvm/trunk/tools/llvm-dis/llvm-dis.cpp Tue Apr 14 22:14:06 2015
>>>> @@ -25,7 +25,6 @@
>>>> #include "llvm/IR/IntrinsicInst.h"
>>>> #include "llvm/IR/Module.h"
>>>> #include "llvm/IR/Type.h"
>>>> -#include "llvm/IR/UseListOrder.h"
>>>> #include "llvm/Support/CommandLine.h"
>>>> #include "llvm/Support/DataStream.h"
>>>> #include "llvm/Support/FileSystem.h"
>>>> @@ -55,6 +54,11 @@ static cl::opt<bool>
>>>> ShowAnnotations("show-annotations",
>>>> cl::desc("Add informational comments to the .ll file"));
>>>>
>>>> +static cl::opt<bool> PreserveAssemblyUseListOrder(
>>>> + "preserve-ll-uselistorder",
>>>> + cl::desc("Preserve use-list order when writing LLVM assembly."),
>>>> + cl::init(false), cl::Hidden);
>>>> +
>>>> namespace {
>>>>
>>>> static void printDebugLoc(const DebugLoc &DL, formatted_raw_ostream &OS) {
>>>> @@ -190,7 +194,7 @@ int main(int argc, char **argv) {
>>>>
>>>> // All that llvm-dis does is write the assembly to a file.
>>>> if (!DontPrint)
>>>> - M->print(Out->os(), Annotator.get(), shouldPreserveAssemblyUseListOrder());
>>>> + M->print(Out->os(), Annotator.get(), PreserveAssemblyUseListOrder);
>>>>
>>>> // Declare success.
>>>> Out->keep();
>>>>
>>>> Modified: llvm/trunk/tools/llvm-extract/llvm-extract.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-extract/llvm-extract.cpp?rev=234973&r1=234972&r2=234973&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/tools/llvm-extract/llvm-extract.cpp (original)
>>>> +++ llvm/trunk/tools/llvm-extract/llvm-extract.cpp Tue Apr 14 22:14:06 2015
>>>> @@ -19,7 +19,6 @@
>>>> #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"
>>>> @@ -91,6 +90,16 @@ static cl::opt<bool>
>>>> OutputAssembly("S",
>>>> cl::desc("Write output as LLVM assembly"), cl::Hidden);
>>>>
>>>> +static cl::opt<bool> PreserveBitcodeUseListOrder(
>>>> + "preserve-bc-uselistorder",
>>>> + cl::desc("Preserve use-list order when writing LLVM bitcode."),
>>>> + cl::init(true), cl::Hidden);
>>>> +
>>>> +static cl::opt<bool> PreserveAssemblyUseListOrder(
>>>> + "preserve-ll-uselistorder",
>>>> + cl::desc("Preserve use-list order when writing LLVM assembly."),
>>>> + cl::init(false), cl::Hidden);
>>>> +
>>>> int main(int argc, char **argv) {
>>>> // Print a stack trace if we signal out.
>>>> sys::PrintStackTraceOnErrorSignal();
>>>> @@ -98,11 +107,6 @@ 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.
>>>> @@ -270,11 +274,10 @@ int main(int argc, char **argv) {
>>>> }
>>>>
>>>> if (OutputAssembly)
>>>> - Passes.add(createPrintModulePass(Out.os(), "",
>>>> - shouldPreserveAssemblyUseListOrder()));
>>>> - else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
>>>> Passes.add(
>>>> - createBitcodeWriterPass(Out.os(), shouldPreserveBitcodeUseListOrder()));
>>>> + createPrintModulePass(Out.os(), "", PreserveAssemblyUseListOrder));
>>>> + else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
>>>> + Passes.add(createBitcodeWriterPass(Out.os(), PreserveBitcodeUseListOrder));
>>>>
>>>> Passes.run(*M.get());
>>>>
>>>>
>>>> Modified: llvm/trunk/tools/llvm-link/llvm-link.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/llvm-link.cpp?rev=234973&r1=234972&r2=234973&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/tools/llvm-link/llvm-link.cpp (original)
>>>> +++ llvm/trunk/tools/llvm-link/llvm-link.cpp Tue Apr 14 22:14:06 2015
>>>> @@ -20,7 +20,6 @@
>>>> #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"
>>>> @@ -60,6 +59,16 @@ static cl::opt<bool>
>>>> SuppressWarnings("suppress-warnings", cl::desc("Suppress all linking warnings"),
>>>> cl::init(false));
>>>>
>>>> +static cl::opt<bool> PreserveBitcodeUseListOrder(
>>>> + "preserve-bc-uselistorder",
>>>> + cl::desc("Preserve use-list order when writing LLVM bitcode."),
>>>> + cl::init(true), cl::Hidden);
>>>> +
>>>> +static cl::opt<bool> PreserveAssemblyUseListOrder(
>>>> + "preserve-ll-uselistorder",
>>>> + cl::desc("Preserve use-list order when writing LLVM assembly."),
>>>> + cl::init(false), cl::Hidden);
>>>> +
>>>> // Read the specified bitcode file in and return it. This routine searches the
>>>> // link path for the specified file to try to find it...
>>>> //
>>>> @@ -105,11 +114,6 @@ 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<Module>("llvm-link", Context);
>>>> @@ -150,10 +154,9 @@ int main(int argc, char **argv) {
>>>>
>>>> if (Verbose) errs() << "Writing bitcode...\n";
>>>> if (OutputAssembly) {
>>>> - Composite->print(Out.os(), nullptr, shouldPreserveAssemblyUseListOrder());
>>>> + Composite->print(Out.os(), nullptr, PreserveAssemblyUseListOrder);
>>>> } else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
>>>> - WriteBitcodeToFile(Composite.get(), Out.os(),
>>>> - shouldPreserveBitcodeUseListOrder());
>>>> + WriteBitcodeToFile(Composite.get(), Out.os(), PreserveBitcodeUseListOrder);
>>>>
>>>> // Declare success.
>>>> Out.keep();
>>>>
>>>> Modified: llvm/trunk/tools/opt/opt.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=234973&r1=234972&r2=234973&view=diff
>>>> ==============================================================================
>>>> --- llvm/trunk/tools/opt/opt.cpp (original)
>>>> +++ llvm/trunk/tools/opt/opt.cpp Tue Apr 14 22:14:06 2015
>>>> @@ -30,7 +30,6 @@
>>>> #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"
>>>> @@ -181,7 +180,15 @@ DefaultDataLayout("default-data-layout",
>>>> cl::desc("data layout string to use if not specified by module"),
>>>> cl::value_desc("layout-string"), cl::init(""));
>>>>
>>>> -
>>>> +static cl::opt<bool> PreserveBitcodeUseListOrder(
>>>> + "preserve-bc-uselistorder",
>>>> + cl::desc("Preserve use-list order when writing LLVM bitcode."),
>>>> + cl::init(true), cl::Hidden);
>>>> +
>>>> +static cl::opt<bool> PreserveAssemblyUseListOrder(
>>>> + "preserve-ll-uselistorder",
>>>> + cl::desc("Preserve use-list order when writing LLVM assembly."),
>>>> + cl::init(false), cl::Hidden);
>>>>
>>>> static inline void addPass(legacy::PassManagerBase &PM, Pass *P) {
>>>> // Add the pass to the pass manager...
>>>> @@ -345,10 +352,6 @@ 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");
>>>>
>>>> @@ -431,9 +434,8 @@ int main(int argc, char **argv) {
>>>> // string. Hand off the rest of the functionality to the new code for that
>>>> // layer.
>>>> return runPassPipeline(argv[0], Context, *M, TM.get(), Out.get(),
>>>> - PassPipeline, OK, VK,
>>>> - shouldPreserveAssemblyUseListOrder(),
>>>> - shouldPreserveBitcodeUseListOrder())
>>>> + PassPipeline, OK, VK, PreserveAssemblyUseListOrder,
>>>> + PreserveBitcodeUseListOrder)
>>>> ? 0
>>>> : 1;
>>>> }
>>>> @@ -557,8 +559,8 @@ int main(int argc, char **argv) {
>>>> }
>>>>
>>>> if (PrintEachXForm)
>>>> - Passes.add(createPrintModulePass(errs(), "",
>>>> - shouldPreserveAssemblyUseListOrder()));
>>>> + Passes.add(
>>>> + createPrintModulePass(errs(), "", PreserveAssemblyUseListOrder));
>>>> }
>>>>
>>>> if (StandardLinkOpts) {
>>>> @@ -595,11 +597,11 @@ int main(int argc, char **argv) {
>>>> // Write bitcode or assembly to the output as the last step...
>>>> if (!NoOutput && !AnalyzeOnly) {
>>>> if (OutputAssembly)
>>>> - Passes.add(createPrintModulePass(Out->os(), "",
>>>> - shouldPreserveAssemblyUseListOrder()));
>>>> + Passes.add(
>>>> + createPrintModulePass(Out->os(), "", PreserveAssemblyUseListOrder));
>>>> else
>>>> - Passes.add(createBitcodeWriterPass(Out->os(),
>>>> - shouldPreserveBitcodeUseListOrder()));
>>>> + Passes.add(
>>>> + createBitcodeWriterPass(Out->os(), PreserveBitcodeUseListOrder));
>>>> }
>>>>
>>>> // Before executing passes, print the final values of the LLVM options.
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
More information about the llvm-commits
mailing list