[PATCH] D72547: [llvm] Make new pass manager's OptimizationLevel a class
Mircea Trofin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 10 16:53:10 PST 2020
mtrofin created this revision.
Herald added subscribers: llvm-commits, cfe-commits, dang, dexonsmith, steven_wu, hiraditya, mehdi_amini.
Herald added projects: clang, LLVM.
mtrofin added reviewers: tejohnson, davidxl.
mtrofin added a comment.
Another example where there is a discrepancy with the old pass manager: in the old pass manager (PassManagerBuilder::addFunctionSimplificationPasses):
if (OptLevel > 1) {
if (EnableGVNHoist)
MPM.add(createGVNHoistPass());
(before this change, new pass manager):
if (Level > O1) {
if (EnableGVNHoist)
FPM.addPass(GVNHoistPass());
Which really means "O2 <https://reviews.llvm.org/owners/package/2/>-3, and Os and Oz". I currently left it backwards compatible - since I'm not sure the added support for gvn hoisting for Os/z was intentional.
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. For example,
(enum) "Level > 1" captures not only O2 <https://reviews.llvm.org/owners/package/2/> and O3 <https://reviews.llvm.org/owners/package/3/>, but also Os, and Oz.
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 <https://reviews.llvm.org/owners/package/3/>,
likely unintentionally.
This change disallows raw comparisons between optimization levels, to
avoid such unintended effects.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D72547
Files:
clang/lib/CodeGen/BackendUtil.cpp
llvm/include/llvm/Passes/PassBuilder.h
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/Passes/PassBuilder.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72547.237461.patch
Type: text/x-patch
Size: 25009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200111/2cd01090/attachment-0001.bin>
More information about the cfe-commits
mailing list