Add the -disable-opt option to LTO. This adds:

- Consistency with opt (which supports the same option with the same meaning and
  description).
- Debugging gold plugin-based linking without optimizations getting in the way.
- Debugging programs linked with the gold plugin while preserving the original
  debug info.
- Fine-grained control over LTO passes using the gold plugin in combination with
  opt (or clang/dragonegg).

Patch by Cristiano Giuffrida!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176257 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2013-02-28 14:11:10 +00:00
parent 279b9184c2
commit 6303b661b3

View File

@ -46,6 +46,10 @@
#include "llvm/Transforms/IPO/PassManagerBuilder.h" #include "llvm/Transforms/IPO/PassManagerBuilder.h"
using namespace llvm; using namespace llvm;
static cl::opt<bool>
DisableOpt("disable-opt", cl::init(false),
cl::desc("Do not run any optimization passes"));
static cl::opt<bool> static cl::opt<bool>
DisableInline("disable-inlining", cl::init(false), DisableInline("disable-inlining", cl::init(false),
cl::desc("Do not run the inliner pass")); cl::desc("Do not run the inliner pass"));
@ -376,10 +380,12 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
// Enabling internalize here would use its AllButMain variant. It // Enabling internalize here would use its AllButMain variant. It
// keeps only main if it exists and does nothing for libraries. Instead // keeps only main if it exists and does nothing for libraries. Instead
// we create the pass ourselves with the symbol list provided by the linker. // we create the pass ourselves with the symbol list provided by the linker.
PassManagerBuilder().populateLTOPassManager(passes, if (!DisableOpt) {
PassManagerBuilder().populateLTOPassManager(passes,
/*Internalize=*/false, /*Internalize=*/false,
!DisableInline, !DisableInline,
DisableGVNLoadPRE); DisableGVNLoadPRE);
}
// Make sure everything is still good. // Make sure everything is still good.
passes.add(createVerifierPass()); passes.add(createVerifierPass());