Jeffrey Yasskin volunteered to benchmark the vectorizer on -O2 or -Os when compiling...
authorNadav Rotem <nrotem@apple.com>
Thu, 6 Jun 2013 22:35:47 +0000 (22:35 +0000)
committerNadav Rotem <nrotem@apple.com>
Thu, 6 Jun 2013 22:35:47 +0000 (22:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183456 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/PassManagerBuilder.cpp

index 986c0b8928c58c412995b99922493d2a4c87a2a0..8ed7704d5a080caa3c1721fcd3dac865643a1db0 100644 (file)
@@ -32,6 +32,12 @@ static cl::opt<bool>
 RunLoopVectorization("vectorize-loops",
                      cl::desc("Run the Loop vectorization passes"));
 
+// This is a helper flag that we use for testing the profitability of
+// vectorization on -O2 and -Os. It should go away once we make a decision.
+static cl::opt<bool>
+VectorizeO2("vectorize-o2",
+            cl::desc("Enable vectorization on all O levels"));
+
 static cl::opt<bool>
 RunSLPVectorization("vectorize-slp",
                     cl::desc("Run the SLP vectorization passes"));
@@ -192,7 +198,7 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
   MPM.add(createLoopIdiomPass());             // Recognize idioms like memset.
   MPM.add(createLoopDeletionPass());          // Delete dead loops
 
-  if (LoopVectorize && OptLevel > 2)
+  if (LoopVectorize && (OptLevel > 2 || VectorizeO2))
     MPM.add(createLoopVectorizePass());
 
   if (!DisableUnrollLoops)