[PATCH] D57422: [LTO] Set CGOptLevel in LTO config.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 29 18:07:03 PST 2019


pcc added a comment.

In D57422#1376550 <https://reviews.llvm.org/D57422#1376550>, @sbc100 wrote:

> Can I ask why you don't want --lto-O0 to set CGOptLevel to None?


The brief answer is: `--lto-O0` means no cross-module optimizations, and just because you don't want cross-module optimizations doesn't mean that you also want poor code quality. For example, control flow integrity requires LTO, and users of CFI who don't want cross-module optimizations (whether for code size, link performance or other reasons) should not expect the code quality to get worse just because they enabled LTO by necessity.



================
Comment at: Common/Args.cpp:20
 
+// TODO(sbc): Remove this once GCOptLevel can be set completely based on bitcode
+// function metadata.
----------------
nit: CGOptLevel


================
Comment at: Common/Args.cpp:29
+  case 3:
+    return CodeGenOpt::Aggressive;
+  }
----------------
Why not:
```
if (OptLevelLTO == 3)
  return CodeGenOpt::Aggressive;
assert(OptLevelLTO < 3);
return CodeGenOpt::Default;
```
?


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57422/new/

https://reviews.llvm.org/D57422





More information about the llvm-commits mailing list