mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Disable unrolling in the loop vectorizer when disabled in the pass manager
When unrolling is disabled in the pass manager, the loop vectorizer should also not unroll loops. This will allow the -fno-unroll-loops option in Clang to behave as expected (even for vectorizable loops). The loop vectorizer's -force-vector-unroll option will (continue to) override the pass-manager setting (including -force-vector-unroll=0 to force use of the internal auto-selection logic). In order to test this, I added a flag to opt (-disable-loop-unrolling) to force disable unrolling through opt (the analog of -fno-unroll-loops in Clang). Also, this fixes a small bug in opt where the loop vectorizer was enabled only after the pass manager populated the queue of passes (the global_alias.ll test needed a slight update to the RUN line as a result of this fix). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189499 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -135,6 +135,11 @@ UnitAtATime("funit-at-a-time",
|
||||
cl::desc("Enable IPO. This is same as llvm-gcc's -funit-at-a-time"),
|
||||
cl::init(true));
|
||||
|
||||
static cl::opt<bool>
|
||||
DisableLoopUnrolling("disable-loop-unrolling",
|
||||
cl::desc("Disable loop unrolling in all relevant passes"),
|
||||
cl::init(false));
|
||||
|
||||
static cl::opt<bool>
|
||||
DisableSimplifyLibCalls("disable-simplify-libcalls",
|
||||
cl::desc("Disable simplify-libcalls"));
|
||||
@@ -447,12 +452,13 @@ static void AddOptimizationPasses(PassManagerBase &MPM,FunctionPassManager &FPM,
|
||||
Builder.Inliner = createAlwaysInlinerPass();
|
||||
}
|
||||
Builder.DisableUnitAtATime = !UnitAtATime;
|
||||
Builder.DisableUnrollLoops = OptLevel == 0;
|
||||
Builder.DisableUnrollLoops = (DisableLoopUnrolling.getNumOccurrences() > 0) ?
|
||||
DisableLoopUnrolling : OptLevel == 0;
|
||||
|
||||
Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2;
|
||||
|
||||
Builder.populateFunctionPassManager(FPM);
|
||||
Builder.populateModulePassManager(MPM);
|
||||
|
||||
Builder.LoopVectorize = OptLevel > 1 && SizeLevel < 2;
|
||||
}
|
||||
|
||||
static void AddStandardCompilePasses(PassManagerBase &PM) {
|
||||
|
Reference in New Issue
Block a user