diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2018-04-06 21:14:33 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2018-04-06 21:14:33 +0000 |
| commit | 4564ed1430774e84b49adaee633dbf1699104c76 (patch) | |
| tree | 9ffc11d89510054c8abce14e7429e403305bc5cd | |
| parent | 431d8c39ba741e01a44a10099324995310af5969 (diff) | |
| download | bcm5719-llvm-4564ed1430774e84b49adaee633dbf1699104c76.tar.gz bcm5719-llvm-4564ed1430774e84b49adaee633dbf1699104c76.zip | |
Revert r324557, "gold-plugin: Do not set codegen opt level based on LTO opt level."
It was reported that this change measurably regressed -plugin-opt=O3
performance.
There is an ongoing discussion on llvm-dev about the correct way to
set the CG opt level, see thread "[llvm-dev] [RFC] Adding function
attributes to represent codegen optimization level".
llvm-svn: 329458
| -rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index d2d0e77d719..6123b8e5a46 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -779,6 +779,20 @@ static int getOutputFileName(StringRef InFilename, bool TempOutFile, return FD; } +static CodeGenOpt::Level getCGOptLevel() { + switch (options::OptLevel) { + case 0: + return CodeGenOpt::None; + case 1: + return CodeGenOpt::Less; + case 2: + return CodeGenOpt::Default; + case 3: + return CodeGenOpt::Aggressive; + } + llvm_unreachable("Invalid optimization level"); +} + /// Parse the thinlto_prefix_replace option into the \p OldPrefix and /// \p NewPrefix strings, if it was specified. static void getThinLTOOldAndNewPrefix(std::string &OldPrefix, @@ -810,6 +824,7 @@ static std::unique_ptr<LTO> createLTO(IndexWriteCallback OnIndexWrite, Conf.MAttrs = MAttrs; Conf.RelocModel = RelocationModel; + Conf.CGOptLevel = getCGOptLevel(); Conf.DisableVerify = options::DisableVerify; Conf.OptLevel = options::OptLevel; if (options::Parallelism) |

