diff options
| author | Nadav Rotem <nrotem@apple.com> | 2013-08-01 22:56:53 +0000 |
|---|---|---|
| committer | Nadav Rotem <nrotem@apple.com> | 2013-08-01 22:56:53 +0000 |
| commit | bd30bf8ac99b433e221cdf444cc2d11fc1753984 (patch) | |
| tree | f58edf06debaa719c365285b44359ef2e8614c4e /lib/Driver/Tools.cpp | |
| parent | 59944677b0576c19a08db92a6b45619077a00baa (diff) | |
| download | clang-bd30bf8ac99b433e221cdf444cc2d11fc1753984.tar.gz clang-bd30bf8ac99b433e221cdf444cc2d11fc1753984.tar.bz2 clang-bd30bf8ac99b433e221cdf444cc2d11fc1753984.tar.xz | |
If -fslp-vectorize or -fno-slp-vectorize are given, honor this selection. If no flag is given, enable it for -O3.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187630 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
| -rw-r--r-- | lib/Driver/Tools.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 3a23732ad3..b6f6c3d737 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1974,6 +1974,12 @@ static bool isOptimizationLevelFast(const ArgList &Args) { return false; } +static bool isOptimizationLevel3(const ArgList &Args) { + if (Arg *A = Args.getLastArg(options::OPT_O_Group)) + return StringRef(A->getValue()).equals("3"); + return false; +} + void Clang::ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, @@ -3452,9 +3458,17 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_fno_vectorize, true)) CmdArgs.push_back("-vectorize-loops"); - // -fslp-vectorize is default. - if (Args.hasFlag(options::OPT_fslp_vectorize, - options::OPT_fno_slp_vectorize, true)) + bool EnableSLP = false; + // If -fslp-vectorize or -fno-slp-vectorize are given, honor this selection. + if (Arg *A = Args.getLastArg(options::OPT_fslp_vectorize, + options::OPT_fno_slp_vectorize)) { + EnableSLP = A->getOption().matches(options::OPT_fslp_vectorize); + } else { + // Also enable SLP vectorization on O3 or OFast + EnableSLP = isOptimizationLevel3(Args) || isOptimizationLevelFast(Args); + } + + if (EnableSLP) CmdArgs.push_back("-vectorize-slp"); // -fno-slp-vectorize-aggressive is default. |
