[llvm] 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
Wed Feb 7 18:41:22 PST 2018


Author: pcc
Date: Wed Feb  7 18:41:22 2018
New Revision: 324557

URL: http://llvm.org/viewvc/llvm-project?rev=324557&view=rev
Log:
gold-plugin: Do not set codegen opt level based on LTO opt level.

The LTO opt level should not affect the codegen opt level, and indeed
it does not affect it in lld. Ideally the codegen opt level should
be controlled by an IR-level attribute based on the compile-time opt
level, but that hasn't been implemented yet.

Differential Revision: https://reviews.llvm.org/D43040

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=324557&r1=324556&r2=324557&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Feb  7 18:41:22 2018
@@ -727,20 +727,6 @@ 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,
@@ -767,7 +753,6 @@ 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