]> granicus.if.org Git - clang/commitdiff
Make -funroll-loops turn on loop unrolling in the optimizer instead
authorEric Christopher <echristo@apple.com>
Sat, 7 Aug 2010 23:08:14 +0000 (23:08 +0000)
committerEric Christopher <echristo@apple.com>
Sat, 7 Aug 2010 23:08:14 +0000 (23:08 +0000)
of just ignoring it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110525 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/CC1Options.td
include/clang/Driver/Options.td
lib/Driver/Tools.cpp
lib/Frontend/CompilerInvocation.cpp

index 50c743a7b9319f36d5351539dad2132c171294cd..20c23215ec0e1e216220d35d597e77a7b1979550 100644 (file)
@@ -139,6 +139,8 @@ def ffunction_sections : Flag<"-ffunction-sections">,
   HelpText<"Place each function in its own section (ELF Only)">;
 def fdata_sections : Flag<"-fdata-sections">,
   HelpText<"Place each data in its own section (ELF Only)">;
+def funroll_loops : Flag<"-funroll-loops">,
+  HelpText<"Turn on loop unroller">;
 def masm_verbose : Flag<"-masm-verbose">,
   HelpText<"Generate verbose assembly output">;
 def mcode_model : Separate<"-mcode-model">,
index e6204f77ad3fe8c7e29c9b37eb25f5d8839f14a1..5fbebd17bd72e20e2d7bf99fe545b67e66672230 100644 (file)
@@ -385,7 +385,7 @@ def fthreadsafe_statics : Flag<"-fthreadsafe-statics">, Group<f_Group>;
 def ftime_report : Flag<"-ftime-report">, Group<f_Group>;
 def ftrapv : Flag<"-ftrapv">, Group<f_Group>;
 def funit_at_a_time : Flag<"-funit-at-a-time">, Group<f_Group>;
-def funroll_loops : Flag<"-funroll-loops">, Group<clang_ignored_f_Group>;
+def funroll_loops : Flag<"-funroll-loops">, Group<f_Group>;
 def funsigned_bitfields : Flag<"-funsigned-bitfields">, Group<f_Group>;
 def funsigned_char : Flag<"-funsigned-char">, Group<f_Group>;
 def funwind_tables : Flag<"-funwind-tables">, Group<f_Group>;
index 19a6a92474c9c724012fa2f4822ea39f2e61c422..8f052791e81a0b4d06534690b35059bac77f1ead 100644 (file)
@@ -1208,6 +1208,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   Args.AddLastArg(CmdArgs, options::OPT_ftrapv);
   Args.AddLastArg(CmdArgs, options::OPT_fwrapv);
   Args.AddLastArg(CmdArgs, options::OPT_fwritable_strings);
+  Args.AddLastArg(CmdArgs, options::OPT_funroll_loops);
 
   Args.AddLastArg(CmdArgs, options::OPT_pthread);
 
index 8f9fa848cbf8cfa242e304bd70ebbc1ab52280e1..aa0c317dd83e8d19ab280af5ca96e1286d4c1930 100644 (file)
@@ -148,9 +148,12 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts,
   // SimplifyLibCalls is only derived.
   // TimePasses is only derived.
   // UnitAtATime is unused.
-  // UnrollLoops is only derived.
   // Inlining is only derived.
-
+  
+  // UnrollLoops is derived, but also accepts an option, no
+  // harm in pushing it back here.
+  if (Opts.UnrollLoops)
+    Res.push_back("-funroll-loops");
   if (Opts.DataSections)
     Res.push_back("-fdata-sections");
   if (Opts.FunctionSections)
@@ -828,7 +831,8 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
   Opts.OptimizeSize = Args.hasArg(OPT_Os);
   Opts.SimplifyLibCalls = !(Args.hasArg(OPT_fno_builtin) ||
                             Args.hasArg(OPT_ffreestanding));
-  Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize);
+  Opts.UnrollLoops = Args.hasArg(OPT_funroll_loops) || 
+                     (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize);
 
   Opts.AsmVerbose = Args.hasArg(OPT_masm_verbose);
   Opts.CXAAtExit = !Args.hasArg(OPT_fno_use_cxa_atexit);