[PATCH] D132623: [CodeGen] Disable tail calls at -O0/-O1
Arthur Eubanks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 7 14:14:29 PDT 2022
aeubanks added a comment.
In D132623#3775541 <https://reviews.llvm.org/D132623#3775541>, @jrtc27 wrote:
> In D132623#3775514 <https://reviews.llvm.org/D132623#3775514>, @aeubanks wrote:
>
>> The contract we have with the -O1 pipeline is to attempt to generate debuggable code as much as possible
>
> No it's not. What we say is:
>
> :option:`-O0` Means "no optimization": this level compiles the fastest and
> generates the most debuggable code.
>
> :option:`-O1` Somewhere between :option:`-O0` and :option:`-O2`.
>
> :option:`-O2` Moderate level of optimization which enables most
> optimizations.
>
> ...
>
>
> :option:`-Og` Like :option:`-O1`. In future versions, this option might
> disable different optimizations in order to improve debuggability.
The -O1 pipeline has been tuned in the past to attempt to keep debuggability, and in OptimizationLevel.h <https://github.com/llvm/llvm-project/blob/178554f3c8f983bd192818b6d46e4d95560c4964/llvm/include/llvm/Passes/OptimizationLevel.h#L43> we say
/// Optimize quickly without destroying debuggability.
///
/// This level is tuned to produce a result from the optimizer as quickly
/// as possible and to avoid destroying debuggability. This tends to result
/// in a very good development mode where the compiled code will be
/// immediately executed as part of testing. As a consequence, where
/// possible, we would like to produce efficient-to-execute code, but not
/// if it significantly slows down compilation or would prevent even basic
/// debugging of the resulting binary.
///
/// As an example, complex loop transformations such as versioning,
/// vectorization, or fusion don't make sense here due to the degree to
/// which the executed code differs from the source code, and the compile
/// time cost.
static const OptimizationLevel O1;
So I'd say that currently we do expect -O1 to generate debuggable code. If there's ever a push for a separate -Og pipeline that's fine, but we don't have that right now.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132623/new/
https://reviews.llvm.org/D132623
More information about the llvm-commits
mailing list