summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/PassManagerBuilder.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2013-08-28 18:33:10 +0000
committerHal Finkel <hfinkel@anl.gov>2013-08-28 18:33:10 +0000
commit435798e96a64738b55a01055dde1bc9a88a15191 (patch)
tree085525155e3ac51b8f7b9ed02f0f4326c5a0c0cd /lib/Transforms/IPO/PassManagerBuilder.cpp
parent4f066b6db8a7a95b206725aecf99a64fd6e9415c (diff)
downloadllvm-435798e96a64738b55a01055dde1bc9a88a15191.tar.gz
llvm-435798e96a64738b55a01055dde1bc9a88a15191.tar.bz2
llvm-435798e96a64738b55a01055dde1bc9a88a15191.tar.xz
Disable unrolling in the loop vectorizer when disabled in the pass manager
When unrolling is disabled in the pass manager, the loop vectorizer should also not unroll loops. This will allow the -fno-unroll-loops option in Clang to behave as expected (even for vectorizable loops). The loop vectorizer's -force-vector-unroll option will (continue to) override the pass-manager setting (including -force-vector-unroll=0 to force use of the internal auto-selection logic). In order to test this, I added a flag to opt (-disable-loop-unrolling) to force disable unrolling through opt (the analog of -fno-unroll-loops in Clang). Also, this fixes a small bug in opt where the loop vectorizer was enabled only after the pass manager populated the queue of passes (the global_alias.ll test needed a slight update to the RUN line as a result of this fix). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189499 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/PassManagerBuilder.cpp')
-rw-r--r--lib/Transforms/IPO/PassManagerBuilder.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/IPO/PassManagerBuilder.cpp b/lib/Transforms/IPO/PassManagerBuilder.cpp
index 743dc42343..d4c0c2caea 100644
--- a/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -196,7 +196,7 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
MPM.add(createLoopDeletionPass()); // Delete dead loops
if (!LateVectorize && LoopVectorize)
- MPM.add(createLoopVectorizePass());
+ MPM.add(createLoopVectorizePass(DisableUnrollLoops));
if (!DisableUnrollLoops)
MPM.add(createLoopUnrollPass()); // Unroll small loops
@@ -250,7 +250,7 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
// Add the various vectorization passes and relevant cleanup passes for
// them since we are no longer in the middle of the main scalar pipeline.
if (LoopVectorize) {
- MPM.add(createLoopVectorizePass());
+ MPM.add(createLoopVectorizePass(DisableUnrollLoops));
if (!DisableUnrollLoops)
MPM.add(createLoopUnrollPass()); // Unroll small loops