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

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 15:14:21 PDT 2022


nickdesaulniers added a comment.

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 also think `--rtlib=none` needs to be recorded in IR to avoid libcalls, too).



================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:4434
 
   if (LC == RTLIB::UNKNOWN_LIBCALL || !TLI.getLibcallName(LC)) {
     // FIXME: This is not an optimal expansion, but better than crashing.
----------------
I feel like if `TLI.getLibcallName()` returns the same string as the fn we're currently ISEL'ing, then we've found a potential inf loop.


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

https://reviews.llvm.org/D131521



More information about the llvm-commits mailing list