summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2013-08-28 04:40:22 +0000
committerHal Finkel <hfinkel@anl.gov>2013-08-28 04:40:22 +0000
commit7d0867f48c6adde6cb5c5df7f1c0068cf2f6a9f4 (patch)
treec11750cb90e1ae66b9567e00418c4949ea659c19 /clang/lib/Driver/Tools.cpp
parent62caa709fe2795b459f3c6ad863271f2b6a000b3 (diff)
downloadbcm5719-llvm-7d0867f48c6adde6cb5c5df7f1c0068cf2f6a9f4.tar.gz
bcm5719-llvm-7d0867f48c6adde6cb5c5df7f1c0068cf2f6a9f4.zip
Disable loop vectorizer unrolling when no unrolling requested
In addition to the regular loop unrolling transformation, the loop vectorizer can also unroll loops. If no unrolling has specifically been requested (by -fno-unroll-loops), and the loop vectorizer will be used, then add the backend option to (also) prevent the loop vectorizer from unrolling loops. I confirmed with Nadav (off list) that disabling vectorizer loop unrolling when -fno-unroll-loops is provided is the desired behavior. llvm-svn: 189440
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index c30c45d26bd..89df632d5c0 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -3382,9 +3382,19 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
OptSpecifier VectorizeAliasOption = EnableVec ? options::OPT_O_Group :
options::OPT_fvectorize;
if (Args.hasFlag(options::OPT_fvectorize, VectorizeAliasOption,
- options::OPT_fno_vectorize, EnableVec))
+ options::OPT_fno_vectorize, EnableVec)) {
CmdArgs.push_back("-vectorize-loops");
+ // In addition to the regular loop unrolling transformation, the loop
+ // vectorizer can also unroll loops. If no unrolling has specifically been
+ // requested, then also prevent the loop vectorizer from unrolling loops.
+ if (Args.hasFlag(options::OPT_fno_unroll_loops,
+ options::OPT_funroll_loops, false)) {
+ CmdArgs.push_back("-backend-option");
+ CmdArgs.push_back("-force-vector-unroll=1");
+ }
+ }
+
// -fslp-vectorize is default.
if (Args.hasFlag(options::OPT_fslp_vectorize,
options::OPT_fno_slp_vectorize, true))
OpenPOWER on IntegriCloud