[llvm] r234921 - IR: Set -preserve-bc-uselistorder=false by default

David Blaikie dblaikie at gmail.com
Tue Apr 14 11:53:38 PDT 2015


On Tue, Apr 14, 2015 at 11:46 AM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

>
> > On 2015-Apr-14, at 11:42, David Blaikie <dblaikie at gmail.com> wrote:
> >
> >
> >
> > On Tue, Apr 14, 2015 at 11:33 AM, Duncan P. N. Exon Smith <
> dexonsmith at apple.com> wrote:
> > Author: dexonsmith
> > Date: Tue Apr 14 13:33:00 2015
> > New Revision: 234921
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=234921&view=rev
> > Log:
> > 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`.
> >
> > Hmm - what's LTOCodeGenerator used for? If it's a standard library
> utility used in production pipelines it might make more sense for it to
> default-off & users can opt-in when necessary?
>
> The usual flow for libLTO.dylib is "read bitcode, link, optimize, codegen,
> write object".  Writing bitcode is used, e.g., by `ld -save-temps`.
>

LTOCodeGenerator is only used to actually generating bitcode from
LTO-merged modules?

Also, what's the deal with global state? (just realizing now that the
"setPreserveBitcodeUseListOrder" is just a global function, not
LLVMContext, etc) - that seems like the sort of thing I'd be even more
inclined to push up into the actual utilities very directly, so there's no
libraries quietly tweaking this global state in surprising ways. Not sure
what sort of ideas on exceptions to the "avoid global state because we're a
library" we have for these sort of things & how to limit their creep.

- David



>
> >
> > Part of PR5680.
> >
> > Modified:
> >     llvm/trunk/lib/IR/UseListOrder.cpp
> >     llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
> >     llvm/trunk/tools/bugpoint/bugpoint.cpp
> >     llvm/trunk/tools/llvm-as/llvm-as.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/lib/IR/UseListOrder.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/UseListOrder.cpp?rev=234921&r1=234920&r2=234921&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/IR/UseListOrder.cpp (original)
> > +++ llvm/trunk/lib/IR/UseListOrder.cpp Tue Apr 14 13:33:00 2015
> > @@ -19,7 +19,7 @@ using namespace llvm;
> >  static cl::opt<bool> 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<bool> PreserveAssemblyUseListOrder(
> >      "preserve-ll-uselistorder",
> >
> > Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=234921&r1=234920&r2=234921&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
> > +++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Tue Apr 14 13:33:00 2015
> > @@ -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::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/bugpoint.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/bugpoint.cpp?rev=234921&r1=234920&r2=234921&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/tools/bugpoint/bugpoint.cpp (original)
> > +++ llvm/trunk/tools/bugpoint/bugpoint.cpp Tue Apr 14 13:33:00 2015
> > @@ -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"
> >
> > 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=234921&r1=234920&r2=234921&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/tools/llvm-as/llvm-as.cpp (original)
> > +++ llvm/trunk/tools/llvm-as/llvm-as.cpp Tue Apr 14 13:33:00 2015
> > @@ -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...
> >
> > 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=234921&r1=234920&r2=234921&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/tools/llvm-extract/llvm-extract.cpp (original)
> > +++ llvm/trunk/tools/llvm-extract/llvm-extract.cpp Tue Apr 14 13:33:00
> 2015
> > @@ -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.
> >
> > 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=234921&r1=234920&r2=234921&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/tools/llvm-link/llvm-link.cpp (original)
> > +++ llvm/trunk/tools/llvm-link/llvm-link.cpp Tue Apr 14 13:33:00 2015
> > @@ -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<Module>("llvm-link", Context);
> >
> > Modified: llvm/trunk/tools/opt/opt.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=234921&r1=234920&r2=234921&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/tools/opt/opt.cpp (original)
> > +++ llvm/trunk/tools/opt/opt.cpp Tue Apr 14 13:33:00 2015
> > @@ -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");
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150414/abb0c248/attachment.html>


More information about the llvm-commits mailing list