[PATCH] D147714: [Attr] Introduce [[clang::nonportable_musttail]] as less strict version of [[clang::musttail]]
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 7 06:24:29 PDT 2023
erichkeane added a comment.
In D147714#4251208 <https://reviews.llvm.org/D147714#4251208>, @xbolva00 wrote:
>>> Could we instead encode the platform specific tail-call rules in Sema? We definitely have attributes that differ in behavior between platforms, and this seems like a perfect candidate.
>
> But then you break promise of musttail that code with musttail will work on any target supported by LLVM.
I should have been clearer: I meant this with a new attribute.
> Plus, while we can relax frontend checks (based on target info), it is true that current LLVM LangRef says that there must be a match between prototypes.
Right, this would require its own llvm-level concept as well.
>>> Higher-level question: are we sure there's enough evidence this will be used in practice to warrant adding it to Clang?
>
> Originally mentioned as request for CTRE project, I have use cases as well, @jacobsa (Github issue) mentioned it:
>
>> Personally I would like the semantics "give me an error if this can't be a tail call on this target", not the semantics "give me an error if this can't be a tail call on all targets clang supports". I suspect most people would be looking for the former, since most people care about nearly none of the supported targets by volume.
>
> I agree with that.
I see value in that, absolutely, but this isn't the way about it. Said new attribute (whether it be `[[should_tail]]` for `[[nonportable_musttail]]`) shouldn't be diagnosing the code generator, it should be diagnosing in SEMA. This requires encoding the platform specific/LLVM-IR specific rules. If LLVM-IR docs require `musttail` rules (that this patch seems to be breaking!), we perhaps need an alternative at the IR level as well.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147714/new/
https://reviews.llvm.org/D147714
More information about the cfe-commits
mailing list