[PATCH] D131521: [SDAG] avoid generating libcall in function with nobuiltin

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 05:56:34 PDT 2022


spatel marked an inline comment as done.
spatel added a comment.

In D131521#3711030 <https://reviews.llvm.org/D131521#3711030>, @nickdesaulniers wrote:

> The langref says of nobuiltin:
>
>> nobuiltin
>> This indicates that the callee function at a call site is not recognized as a built-in function. LLVM will retain the original call and not replace it with equivalent code based on the semantics of the built-in function, unless the call site uses the builtin attribute. This is valid at call sites and on function declarations and definitions.
>
> Isn't this patch now doing the opposite?  If the callee is marked `nobuiltin`, we should retain the call explicitly as written unless the call site is attributed as `builtin`.  Or am I misreading the langref?  Otherwise, what is the point of nobuiltin in this test?

I hadn't read that text in a while. I was assuming that "nobuiltin" on this function meant that it could not call builtins (and I think that was the desired behavior in the bug report). But I agree - the way it is defined is the opposite. I'm not familiar with how this is supposed to work. I see that if you build C source with "-ffreestanding", then the functions will have a different attribute -- "no-builtins" -- is that the attribute we should be detecting here?

Or we bail out with a combination of (1) this function is marked "nobuiltin" / "no-builtins" and (2) it is potentially calling a function with the same name (as suggested in the inline comment)?


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

https://reviews.llvm.org/D131521



More information about the llvm-commits mailing list