r189218 - Simplify now that -O4 just maps to -O3 and -O is an alias of -O2.

Jordan Rose jordan_rose at apple.com
Mon Aug 26 09:11:18 PDT 2013


Any way to warn on the use of "-O4" this way? I still think that's a good idea for at least one release.

On Aug 26, 2013, at 7:05 , Rafael Espindola <rafael.espindola at gmail.com> wrote:

> Author: rafael
> Date: Mon Aug 26 09:05:41 2013
> New Revision: 189218
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=189218&view=rev
> Log:
> Simplify now that -O4 just maps to -O3 and -O is an alias of -O2.
> 
> Modified:
>    cfe/trunk/include/clang/Driver/Options.td
>    cfe/trunk/lib/Driver/Tools.cpp
> 
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=189218&r1=189217&r2=189218&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Mon Aug 26 09:05:41 2013
> @@ -214,13 +214,13 @@ def MT : JoinedOrSeparate<["-"], "MT">,
> def Mach : Flag<["-"], "Mach">;
> def M : Flag<["-"], "M">, Group<M_Group>;
> def O0 : Flag<["-"], "O0">, Group<O_Group>, Flags<[CC1Option]>;
> -def O4 : Flag<["-"], "O4">, Group<O_Group>, Flags<[CC1Option]>;
> def ObjCXX : Flag<["-"], "ObjC++">, Flags<[DriverOption]>,
>   HelpText<"Treat source input files as Objective-C++ inputs">;
> def ObjC : Flag<["-"], "ObjC">, Flags<[DriverOption]>,
>   HelpText<"Treat source input files as Objective-C inputs">;
> def O : Joined<["-"], "O">, Group<O_Group>, Flags<[CC1Option]>;
> def O_flag : Flag<["-"], "O">, Flags<[CC1Option]>, Alias<O>, AliasArgs<["2"]>;
> +def O4 : Flag<["-"], "O4">, Alias<O>, AliasArgs<["3"]>;
> def Ofast : Joined<["-"], "Ofast">, Group<O_Group>, Flags<[CC1Option]>;
> def P : Flag<["-"], "P">, Flags<[CC1Option]>,
>   HelpText<"Disable linemarker output in -E mode">;
> 
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=189218&r1=189217&r2=189218&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Mon Aug 26 09:05:41 2013
> @@ -1863,8 +1863,7 @@ static bool isOptimizationLevelFast(cons
> /// \brief Vectorize at all optimization levels greater than 1 except for -Oz.
> static bool shouldEnableVectorizerAtOLevel(const ArgList &Args) {
>   if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
> -    if (A->getOption().matches(options::OPT_O4) ||
> -        A->getOption().matches(options::OPT_Ofast))
> +    if (A->getOption().matches(options::OPT_Ofast))
>       return true;
> 
>     if (A->getOption().matches(options::OPT_O0))
> @@ -1872,9 +1871,9 @@ static bool shouldEnableVectorizerAtOLev
> 
>     assert(A->getOption().matches(options::OPT_O) && "Must have a -O flag");
> 
> -    // Vectorize -O (which really is -O2), -Os.
> +    // Vectorize -Os.
>     StringRef S(A->getValue());
> -    if (S == "s" || S.empty())
> +    if (S == "s")
>       return true;
> 
>     // Don't vectorize -Oz.
> @@ -2623,13 +2622,8 @@ void Clang::ConstructJob(Compilation &C,
>   // preprocessed inputs and configure concludes that -fPIC is not supported.
>   Args.ClaimAllArgs(options::OPT_D);
> 
> -  // Manually translate -O4 to -O3; let clang reject others.
> -  if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
> -    if (A->getOption().matches(options::OPT_O4))
> -      CmdArgs.push_back("-O3");
> -    else
> -      A->render(Args, CmdArgs);
> -  }
> +  if (Arg *A = Args.getLastArg(options::OPT_O_Group))
> +    A->render(Args, CmdArgs);
> 
>   // Don't warn about unused -flto.  This can happen when we're preprocessing or
>   // precompiling.
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list