[llvm] r329458 - Revert r324557, "gold-plugin: Do not set codegen opt level based on LTO opt level."
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 6 14:14:33 PDT 2018
Author: pcc
Date: Fri Apr 6 14:14:33 2018
New Revision: 329458
URL: http://llvm.org/viewvc/llvm-project?rev=329458&view=rev
Log:
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".
Modified:
llvm/trunk/tools/gold/gold-plugin.cpp
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=329458&r1=329457&r2=329458&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Fri Apr 6 14:14:33 2018
@@ -779,6 +779,20 @@ static int getOutputFileName(StringRef I
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(In
Conf.MAttrs = MAttrs;
Conf.RelocModel = RelocationModel;
+ Conf.CGOptLevel = getCGOptLevel();
Conf.DisableVerify = options::DisableVerify;
Conf.OptLevel = options::OptLevel;
if (options::Parallelism)
More information about the llvm-commits
mailing list