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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 13:00:10 PDT 2022


efriedma added a comment.

There are basically two different forms of LLVM "knowing" the meaning of a library call:

1. We assume we have a full-featured C library, with properties annotated in TargetLibraryInfo.  This basically corresponds to -fno-builtin/"no-builtins".
2. If input IR contains certain constructs, we assume the corresponding compiler-rt/libm calls from include/llvm/IR/RuntimeLibcalls.def are available.  Really, the issue here is that even if we wanted to avoid generating libcalls, we don't actually have an alternative in a lot of cases: no other lowering is implemented in LLVM.

Most the functionality from RuntimeLibcalls.def for integer/float arithmetic doesn't require any runtime, so we could in theory provide it some other way, like embedding an implementation into the object file.  We've sort of started moving in this direction (see D126644 <https://reviews.llvm.org/D126644>).

Not sure we should be keying this off of "no-builtins"; having a C library is different from having compiler-rt builtins.  We generally expect freestanding binaries to include compiler-rt builtins, but not a C library.


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

https://reviews.llvm.org/D131521



More information about the llvm-commits mailing list