diff options
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopRotation.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopRotation.cpp b/llvm/lib/Transforms/Scalar/LoopRotation.cpp index 32d2caa78da..0225cc32570 100644 --- a/llvm/lib/Transforms/Scalar/LoopRotation.cpp +++ b/llvm/lib/Transforms/Scalar/LoopRotation.cpp @@ -622,7 +622,8 @@ bool LoopRotate::processLoop(Loop *L) { return MadeChange; } -LoopRotatePass::LoopRotatePass() {} +LoopRotatePass::LoopRotatePass(bool EnableHeaderDuplication) + : EnableHeaderDuplication(EnableHeaderDuplication) {} PreservedAnalyses LoopRotatePass::run(Loop &L, LoopAnalysisManager &AM) { auto &FAM = AM.getResult<FunctionAnalysisManagerLoopProxy>(L).getManager(); @@ -636,7 +637,8 @@ PreservedAnalyses LoopRotatePass::run(Loop &L, LoopAnalysisManager &AM) { // Optional analyses. auto *DT = FAM.getCachedResult<DominatorTreeAnalysis>(*F); auto *SE = FAM.getCachedResult<ScalarEvolutionAnalysis>(*F); - LoopRotate LR(DefaultRotationThreshold, LI, TTI, AC, DT, SE); + int Threshold = EnableHeaderDuplication ? DefaultRotationThreshold : 0; + LoopRotate LR(Threshold, LI, TTI, AC, DT, SE); bool Changed = LR.processLoop(&L); if (!Changed) |

