[PATCH] D83906: [CodeGen] Emit a call instruction instead of an invoke if the called llvm function is marked nounwind

Hongtao Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 9 17:11:10 PST 2023


hoy added a comment.

In D83906#4182904 <https://reviews.llvm.org/D83906#4182904>, @dexonsmith wrote:

> In D83906#4182847 <https://reviews.llvm.org/D83906#4182847>, @hoy wrote:
>
>> As far as I know, the optimizer IPO pass that infers function attributes (i..e `InferFunctionAttrsPass`) is placed at the very beginning of the optimization pipeline.  Does this sound to you that the side effects computed for linkonce_odr functions there can be trusted by the rest of the pipeline?
>
> Depends what you mean by "trusted". It assumes the attributes accurately describe the function it sees. The properties promised there will apply if/when the code is inlined. But, since the commit in 2016, it doesn't trust that they fully describe the source semantics, so IPA ignores them when the function is not inlined.
>
> Note that the optimizer doesn't know if its input IR has already been optimized. Is this the first optimizer that has run on the IR, or could side effects have been refined away already? E.g., if the optimization pipeline in question runs at LTO time, the compile-time optimization pipeline has already run.

Wondering if we can come up with a way to tell the optimizer about that, e.g., through a new module flag. When it comes to LTO, the selection of linkonce_odr symbols should already been done and the optimizer may be able to recompute the attributes based on pre-LTO attributes, or at least we can allow IPO to one module only, which should still do a better job than FE does?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83906



More information about the cfe-commits mailing list