From c59ae207ef7b79a2bbfe2f36ac7512426ef3c64e Mon Sep 17 00:00:00 2001 From: Nadav Rotem Date: Mon, 29 Oct 2012 16:36:25 +0000 Subject: [PATCH] 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. llvm-svn: 166937 --- llvm/docs/ReleaseNotes.html | 3 ++- llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h | 3 ++- llvm/lib/Transforms/IPO/PassManagerBuilder.cpp | 12 ++++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/llvm/docs/ReleaseNotes.html b/llvm/docs/ReleaseNotes.html index eb12b33..fa986a8 100644 --- a/llvm/docs/ReleaseNotes.html +++ b/llvm/docs/ReleaseNotes.html @@ -468,9 +468,10 @@ Release Notes.

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 - can be enabled using the -mllvm -vectorize flag. + can be enabled using the -mllvm -vectorize-loops flag. The SIMD vector width can be specified using the flag -mllvm -force-vector-width=4. + The defaule value is 0 which means auto-select.
We can now vectorize this code: diff --git a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h b/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h index 47ce902..68557bd 100644 --- a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h +++ b/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h @@ -103,7 +103,8 @@ public: bool DisableSimplifyLibCalls; bool DisableUnitAtATime; bool DisableUnrollLoops; - bool Vectorize; + bool BBVectorize; + bool LoopVectorize; private: /// ExtensionList - This is list of all of the extensions that are registered. diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp index e3bc94e..2b16e20 100644 --- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -33,7 +33,10 @@ using namespace llvm; static cl::opt -RunVectorization("vectorize", cl::desc("Run vectorization passes")); +RunLoopVectorization("vectorize-loops", cl::desc("Run the Loop vectorization passes")); + +static cl::opt +RunBBVectorization("vectorize", cl::desc("Run the BB vectorization passes")); static cl::opt UseGVNAfterVectorization("use-gvn-after-vectorization", @@ -52,7 +55,8 @@ PassManagerBuilder::PassManagerBuilder() { DisableSimplifyLibCalls = false; DisableUnitAtATime = false; DisableUnrollLoops = false; - Vectorize = RunVectorization; + BBVectorize = RunBBVectorization; + LoopVectorize = RunLoopVectorization; } PassManagerBuilder::~PassManagerBuilder() { @@ -185,7 +189,7 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) { MPM.add(createLoopIdiomPass()); // Recognize idioms like memset. MPM.add(createLoopDeletionPass()); // Delete dead loops - if (Vectorize) { + if (LoopVectorize) { MPM.add(createLoopVectorizePass()); MPM.add(createLICMPass()); } @@ -208,7 +212,7 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) { addExtensionsToPM(EP_ScalarOptimizerLate, MPM); - if (Vectorize) { + if (BBVectorize) { MPM.add(createBBVectorizePass()); MPM.add(createInstructionCombiningPass()); if (OptLevel > 1 && UseGVNAfterVectorization) -- 2.7.4