Change the PassManagerBuilder (used by -O3) loop vectorizer flag from -vectorize to -vectorize-loops because we dont want to share the same flag as the bb-vectorizer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166937 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nadav Rotem
2012-10-29 16:36:25 +00:00
parent b9051db24a
commit d233b78760
3 changed files with 12 additions and 6 deletions

View File

@@ -468,9 +468,10 @@ Release Notes</a>.</h1>
<p> Loop Vectorizer - We've added a loop vectorizer and we are now able to <p> Loop Vectorizer - We've added a loop vectorizer and we are now able to
vectorize small loops. The loop vectorizer is disabled by default and vectorize small loops. The loop vectorizer is disabled by default and
can be enabled using the <b>-mllvm -vectorize</b> flag. can be enabled using the <b>-mllvm -vectorize-loops</b> flag.
The SIMD vector width can be specified using the flag The SIMD vector width can be specified using the flag
<b>-mllvm -force-vector-width=4</b>. <b>-mllvm -force-vector-width=4</b>.
The defaule value is <b>0</b> which means auto-select.
<br/> <br/>
We can now vectorize this code: We can now vectorize this code:

View File

@@ -103,7 +103,8 @@ public:
bool DisableSimplifyLibCalls; bool DisableSimplifyLibCalls;
bool DisableUnitAtATime; bool DisableUnitAtATime;
bool DisableUnrollLoops; bool DisableUnrollLoops;
bool Vectorize; bool BBVectorize;
bool LoopVectorize;
private: private:
/// ExtensionList - This is list of all of the extensions that are registered. /// ExtensionList - This is list of all of the extensions that are registered.

View File

@@ -33,7 +33,10 @@
using namespace llvm; using namespace llvm;
static cl::opt<bool> static cl::opt<bool>
RunVectorization("vectorize", cl::desc("Run vectorization passes")); RunLoopVectorization("vectorize-loops", cl::desc("Run the Loop vectorization passes"));
static cl::opt<bool>
RunBBVectorization("vectorize", cl::desc("Run the BB vectorization passes"));
static cl::opt<bool> static cl::opt<bool>
UseGVNAfterVectorization("use-gvn-after-vectorization", UseGVNAfterVectorization("use-gvn-after-vectorization",
@@ -52,7 +55,8 @@ PassManagerBuilder::PassManagerBuilder() {
DisableSimplifyLibCalls = false; DisableSimplifyLibCalls = false;
DisableUnitAtATime = false; DisableUnitAtATime = false;
DisableUnrollLoops = false; DisableUnrollLoops = false;
Vectorize = RunVectorization; BBVectorize = RunBBVectorization;
LoopVectorize = RunLoopVectorization;
} }
PassManagerBuilder::~PassManagerBuilder() { PassManagerBuilder::~PassManagerBuilder() {
@@ -185,7 +189,7 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
MPM.add(createLoopIdiomPass()); // Recognize idioms like memset. MPM.add(createLoopIdiomPass()); // Recognize idioms like memset.
MPM.add(createLoopDeletionPass()); // Delete dead loops MPM.add(createLoopDeletionPass()); // Delete dead loops
if (Vectorize) { if (LoopVectorize) {
MPM.add(createLoopVectorizePass()); MPM.add(createLoopVectorizePass());
MPM.add(createLICMPass()); MPM.add(createLICMPass());
} }
@@ -208,7 +212,7 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
addExtensionsToPM(EP_ScalarOptimizerLate, MPM); addExtensionsToPM(EP_ScalarOptimizerLate, MPM);
if (Vectorize) { if (BBVectorize) {
MPM.add(createBBVectorizePass()); MPM.add(createBBVectorizePass());
MPM.add(createInstructionCombiningPass()); MPM.add(createInstructionCombiningPass());
if (OptLevel > 1 && UseGVNAfterVectorization) if (OptLevel > 1 && UseGVNAfterVectorization)