From: Rafael Espindola Date: Mon, 26 Aug 2013 14:05:41 +0000 (+0000) Subject: Simplify now that -O4 just maps to -O3 and -O is an alias of -O2. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=168de198e5b2333b9135a5c00546da558dbb8527;p=clang Simplify now that -O4 just maps to -O3 and -O is an alias of -O2. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189218 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index a9e2f53d2a..b6ecdcd6a9 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -214,13 +214,13 @@ def MT : JoinedOrSeparate<["-"], "MT">, Group, Flags<[CC1Option]>, def Mach : Flag<["-"], "Mach">; def M : Flag<["-"], "M">, Group; def O0 : Flag<["-"], "O0">, Group, Flags<[CC1Option]>; -def O4 : Flag<["-"], "O4">, 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, Flags<[CC1Option]>; def O_flag : Flag<["-"], "O">, Flags<[CC1Option]>, Alias, AliasArgs<["2"]>; +def O4 : Flag<["-"], "O4">, Alias, AliasArgs<["3"]>; def Ofast : Joined<["-"], "Ofast">, Group, Flags<[CC1Option]>; def P : Flag<["-"], "P">, Flags<[CC1Option]>, HelpText<"Disable linemarker output in -E mode">; diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 1d5b18f0c9..49deb26e6a 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1863,8 +1863,7 @@ static bool isOptimizationLevelFast(const ArgList &Args) { /// \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 shouldEnableVectorizerAtOLevel(const ArgList &Args) { 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, const JobAction &JA, // 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.