summaryrefslogtreecommitdiff
path: root/tools/llvm-lto2
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-10-31 22:12:21 +0000
committerTeresa Johnson <tejohnson@google.com>2016-10-31 22:12:21 +0000
commit485ef16bd4bbcaf9610b2f1423f4f0f639203c26 (patch)
treea639f8bb1001e69a7f481558580bd9fb358dbc8a /tools/llvm-lto2
parent8ddde8c45fe3a434ce5642635098faa14240a6bd (diff)
[ThinLTO] Disable importing and other cross-module optis at -O0
Summary: There is no point to importing at -O0, since we won't inline. We should also disable other cross-module optimizations. (Plan to backport this fix to the 3.9 branch to fix PR30774) Reviewers: pcc Subscribers: johanengelen, mehdi_amini Differential Revision: https://reviews.llvm.org/D25918 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285648 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-lto2')
-rw-r--r--tools/llvm-lto2/llvm-lto2.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/llvm-lto2/llvm-lto2.cpp b/tools/llvm-lto2/llvm-lto2.cpp
index 042f874596f..b48f6c1993e 100644
--- a/tools/llvm-lto2/llvm-lto2.cpp
+++ b/tools/llvm-lto2/llvm-lto2.cpp
@@ -26,6 +26,11 @@ using namespace llvm;
using namespace lto;
using namespace object;
+static cl::opt<char>
+ OptLevel("O", cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
+ "(default = '-O2')"),
+ cl::Prefix, cl::ZeroOrMore, cl::init('2'));
+
static cl::list<std::string> InputFilenames(cl::Positional, cl::OneOrMore,
cl::desc("<input bitcode files>"));
@@ -145,6 +150,8 @@ int main(int argc, char **argv) {
Conf.OptPipeline = OptPipeline;
Conf.AAPipeline = AAPipeline;
+ Conf.OptLevel = OptLevel - '0';
+
ThinBackend Backend;
if (ThinLTODistributedIndexes)
Backend = createWriteIndexesThinBackend("", "", true, "");