[PATCH] D45915: Teach llc about -Oz and -Os

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 23 09:49:52 PDT 2018


paquette updated this revision to Diff 143582.
paquette added a comment.

Added context to diff.


https://reviews.llvm.org/D45915

Files:
  tools/llc/llc.cpp


Index: tools/llc/llc.cpp
===================================================================
--- tools/llc/llc.cpp
+++ tools/llc/llc.cpp
@@ -83,7 +83,7 @@
 // Determine optimization level.
 static cl::opt<char>
 OptLevel("O",
-         cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
+         cl::desc("Optimization level. [-O0, -O1, -O2, -O3, -Oz, or -Os] "
                   "(default = '-O2')"),
          cl::Prefix,
          cl::ZeroOrMore,
@@ -423,6 +423,7 @@
   std::string CPUStr = getCPUStr(), FeaturesStr = getFeaturesStr();
 
   CodeGenOpt::Level OLvl = CodeGenOpt::Default;
+  CodeGenSizeOpt::Level SLvl = CodeGenSizeOpt::None;
   switch (OptLevel) {
   default:
     errs() << argv[0] << ": invalid optimization level.\n";
@@ -432,6 +433,8 @@
   case '1': OLvl = CodeGenOpt::Less; break;
   case '2': OLvl = CodeGenOpt::Default; break;
   case '3': OLvl = CodeGenOpt::Aggressive; break;
+  case 's': SLvl = CodeGenSizeOpt::OptSize; break;
+  case 'z': SLvl = CodeGenSizeOpt::MinSize; break;
   }
 
   TargetOptions Options = InitTargetOptionsFromCodeGenFlags();
@@ -445,7 +448,7 @@
 
   std::unique_ptr<TargetMachine> Target(TheTarget->createTargetMachine(
       TheTriple.getTriple(), CPUStr, FeaturesStr, Options, getRelocModel(),
-      getCodeModel(), OLvl));
+      getCodeModel(), OLvl, SLvl));
 
   assert(Target && "Could not allocate target machine!");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45915.143582.patch
Type: text/x-patch
Size: 1389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180423/36338bca/attachment.bin>


More information about the llvm-commits mailing list