mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 00:17:01 +00:00
Add a new option -run-slp-after-loop-vectorization.
This swaps the order of the loop vectorizer and the SLP/BB vectorizers. It is disabled by default so we can do performance testing - ideally we want to change to having the loop vectorizer running first, and the SLP vectorizer using its leftovers instead of the other way around. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214963 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -57,6 +57,13 @@ static cl::opt<bool> RunLoadCombine("combine-loads", cl::init(false),
|
|||||||
cl::Hidden,
|
cl::Hidden,
|
||||||
cl::desc("Run the load combining pass"));
|
cl::desc("Run the load combining pass"));
|
||||||
|
|
||||||
|
static cl::opt<bool>
|
||||||
|
RunSLPAfterLoopVectorization("run-slp-after-loop-vectorization",
|
||||||
|
cl::init(false), cl::Hidden,
|
||||||
|
cl::desc("Run the SLP vectorizer (and BB vectorizer) after the Loop "
|
||||||
|
"vectorizer instead of before"));
|
||||||
|
|
||||||
|
|
||||||
PassManagerBuilder::PassManagerBuilder() {
|
PassManagerBuilder::PassManagerBuilder() {
|
||||||
OptLevel = 2;
|
OptLevel = 2;
|
||||||
SizeLevel = 0;
|
SizeLevel = 0;
|
||||||
@@ -227,21 +234,23 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
|
|||||||
|
|
||||||
if (RerollLoops)
|
if (RerollLoops)
|
||||||
MPM.add(createLoopRerollPass());
|
MPM.add(createLoopRerollPass());
|
||||||
if (SLPVectorize)
|
if (!RunSLPAfterLoopVectorization) {
|
||||||
MPM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains.
|
if (SLPVectorize)
|
||||||
|
MPM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains.
|
||||||
|
|
||||||
if (BBVectorize) {
|
if (BBVectorize) {
|
||||||
MPM.add(createBBVectorizePass());
|
MPM.add(createBBVectorizePass());
|
||||||
MPM.add(createInstructionCombiningPass());
|
MPM.add(createInstructionCombiningPass());
|
||||||
addExtensionsToPM(EP_Peephole, MPM);
|
addExtensionsToPM(EP_Peephole, MPM);
|
||||||
if (OptLevel > 1 && UseGVNAfterVectorization)
|
if (OptLevel > 1 && UseGVNAfterVectorization)
|
||||||
MPM.add(createGVNPass()); // Remove redundancies
|
MPM.add(createGVNPass()); // Remove redundancies
|
||||||
else
|
else
|
||||||
MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
|
MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
|
||||||
|
|
||||||
// BBVectorize may have significantly shortened a loop body; unroll again.
|
// BBVectorize may have significantly shortened a loop body; unroll again.
|
||||||
if (!DisableUnrollLoops)
|
if (!DisableUnrollLoops)
|
||||||
MPM.add(createLoopUnrollPass());
|
MPM.add(createLoopUnrollPass());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LoadCombine)
|
if (LoadCombine)
|
||||||
@@ -263,6 +272,26 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
|
|||||||
// as function calls, so that we can only pass them when the vectorizer
|
// as function calls, so that we can only pass them when the vectorizer
|
||||||
// changed the code.
|
// changed the code.
|
||||||
MPM.add(createInstructionCombiningPass());
|
MPM.add(createInstructionCombiningPass());
|
||||||
|
|
||||||
|
if (RunSLPAfterLoopVectorization) {
|
||||||
|
if (SLPVectorize)
|
||||||
|
MPM.add(createSLPVectorizerPass()); // Vectorize parallel scalar chains.
|
||||||
|
|
||||||
|
if (BBVectorize) {
|
||||||
|
MPM.add(createBBVectorizePass());
|
||||||
|
MPM.add(createInstructionCombiningPass());
|
||||||
|
addExtensionsToPM(EP_Peephole, MPM);
|
||||||
|
if (OptLevel > 1 && UseGVNAfterVectorization)
|
||||||
|
MPM.add(createGVNPass()); // Remove redundancies
|
||||||
|
else
|
||||||
|
MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
|
||||||
|
|
||||||
|
// BBVectorize may have significantly shortened a loop body; unroll again.
|
||||||
|
if (!DisableUnrollLoops)
|
||||||
|
MPM.add(createLoopUnrollPass());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addExtensionsToPM(EP_Peephole, MPM);
|
addExtensionsToPM(EP_Peephole, MPM);
|
||||||
MPM.add(createCFGSimplificationPass());
|
MPM.add(createCFGSimplificationPass());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user