[PATCH] D132623: [CodeGen] Disable tail calls at -O0/-O1

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 12 10:15:11 PDT 2022


aeubanks added a comment.

In D132623#3756786 <https://reviews.llvm.org/D132623#3756786>, @probinson wrote:

> In D132623#3756345 <https://reviews.llvm.org/D132623#3756345>, @nikic wrote:
>
>> Why does this need to use an attribute rather than querying optimization level in the backend?
>
> The attribute already exists and is used in several places.  This patch just adds the attribute to more functions.

This seems less magical and more explicit. I also didn't want to make sure I had found every place that could possibly check the attribute and have potential future changes miss disabling tail calls for -O1.

And +1 to rnk's comment, although we only LTO at an IR level, not at an MIR/object file level.

Still trying to understand exactly what's going on with the symbolizer (which is just llvm-symbolizer)

In D132623#3779146 <https://reviews.llvm.org/D132623#3779146>, @dblaikie wrote:

>> For that reason I don't think the frontend should be responsible for adding the attribute.
>
> Not sure I follow - the "optnone at -O0" is implemented in the frontend, seems suitable to implement this one the same way, especially if we already have the attribute and infrastructure for it?

This actually came up in a talk with some people recently.
It would be interesting to have some sort of monolithic pipeline where we embed -O0/1/2/3/s/z attributes per-function in the frontend and don't have per-optimization-level pipelines. Currently we have function attributes for -O0/s/z but not the others. -O1 is fairly distinct from -O2/3 in that we want to preserve debuggability. However, we don't have an -O1 function attribute yet, so I don't think what you're proposing makes sense with the current state of things where we express our intent via the optimization level parameter to the optimization pipeline.


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