[CodeGen] only add nobuiltin to inline builtins if we'll emit them
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Wed, 15 Apr 2020 18:05:22 +0000 (11:05 -0700)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Wed, 15 Apr 2020 18:05:22 +0000 (11:05 -0700)
commit2dd17ff08165e6118e70f00e22b2c36d2d4e0a9a
treefd92b5152b981d7283bed722544f1787e8ec1c5f
parentf42baaab4f86d5259717bd26f713c002fd225669
[CodeGen] only add nobuiltin to inline builtins if we'll emit them

There are some inline builtin definitions that we can't emit
(isTriviallyRecursive & callers go into why). Marking these
nobuiltin is only useful if we actually emit the body, so don't mark
these as such unless we _do_ plan on emitting that.

This suboptimality was encountered in Linux (see some discussion on
D71082, and https://github.com/ClangBuiltLinux/linux/issues/979).

Differential Revision: https://reviews.llvm.org/D78162
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/CodeGen/memcpy-no-nobuiltin-if-not-emitted.c [new file with mode: 0644]