aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
authorMircea Trofin <mtrofin@google.com>2020-01-16 08:51:50 -0800
committerMircea Trofin <mtrofin@google.com>2020-01-16 09:00:56 -0800
commit7acfda633f1378344efde22bfed242dd56c26cdd (patch)
tree617e1965c08b2a34899400a2ef9eb34d85b8c655 /llvm/lib/LTO/LTOBackend.cpp
parentc29a9f64b78e98ff4f23e7a48df7cb7a100a9676 (diff)
downloadllvm-7acfda633f1378344efde22bfed242dd56c26cdd.zip
llvm-7acfda633f1378344efde22bfed242dd56c26cdd.tar.gz
llvm-7acfda633f1378344efde22bfed242dd56c26cdd.tar.bz2
[llvm] Make new pass manager's OptimizationLevel a class
Summary: The old pass manager separated speed optimization and size optimization levels into two unsigned values. Coallescing both in an enum in the new pass manager may lead to unintentional casts and comparisons. In particular, taking a look at how the loop unroll passes were constructed previously, the Os/Oz are now (==new pass manager) treated just like O3, likely unintentionally. This change disallows raw comparisons between optimization levels, to avoid such unintended effects. As an effect, the O{s|z} behavior changes for loop unrolling and loop unroll and jam, matching O2 rather than O3. The change also parameterizes the threshold values used for loop unrolling, primarily to aid testing. Reviewers: tejohnson, davidxl Reviewed By: tejohnson Subscribers: zzheng, ychen, mehdi_amini, hiraditya, steven_wu, dexonsmith, dang, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D72547
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index dcde727..3cd84ad 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -203,16 +203,16 @@ static void runNewPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
default:
llvm_unreachable("Invalid optimization level");
case 0:
- OL = PassBuilder::O0;
+ OL = PassBuilder::OptimizationLevel::O0;
break;
case 1:
- OL = PassBuilder::O1;
+ OL = PassBuilder::OptimizationLevel::O1;
break;
case 2:
- OL = PassBuilder::O2;
+ OL = PassBuilder::OptimizationLevel::O2;
break;
case 3:
- OL = PassBuilder::O3;
+ OL = PassBuilder::OptimizationLevel::O3;
break;
}