By default, use Early-CSE instead of GVN for vectorization cleanup.

As has been suggested by Duncan and others, Early-CSE and GVN should
do similar redundancy elimination, but Early-CSE is much less expensive.
Most of my autovectorization benchmarks show a performance regresion, but
all of these are < 0.1%, and so I think that it is still worth using
the less expensive pass.

llvm-svn: 154673
This commit is contained in:
Hal Finkel 2012-04-13 17:15:33 +00:00
parent 0481c8f206
commit 204bf5352a
1 changed files with 9 additions and 2 deletions

View File

@ -35,6 +35,11 @@ using namespace llvm;
static cl::opt<bool> static cl::opt<bool>
RunVectorization("vectorize", cl::desc("Run vectorization passes")); RunVectorization("vectorize", cl::desc("Run vectorization passes"));
static cl::opt<bool>
UseGVNAfterVectorization("use-gvn-after-vectorization",
cl::init(false), cl::Hidden,
cl::desc("Run GVN instead of Early CSE after vectorization passes"));
PassManagerBuilder::PassManagerBuilder() { PassManagerBuilder::PassManagerBuilder() {
OptLevel = 2; OptLevel = 2;
SizeLevel = 0; SizeLevel = 0;
@ -182,8 +187,10 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
if (Vectorize) { if (Vectorize) {
MPM.add(createBBVectorizePass()); MPM.add(createBBVectorizePass());
MPM.add(createInstructionCombiningPass()); MPM.add(createInstructionCombiningPass());
if (OptLevel > 1) if (OptLevel > 1 && UseGVNAfterVectorization)
MPM.add(createGVNPass()); // Remove redundancies MPM.add(createGVNPass()); // Remove redundancies
else
MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
} }
MPM.add(createAggressiveDCEPass()); // Delete dead instructions MPM.add(createAggressiveDCEPass()); // Delete dead instructions