]> granicus.if.org Git - llvm/commit
[InstrProf] Don't take the address of alwaysinline available_externally functions
authorVedant Kumar <vsk@apple.com>
Tue, 13 Jun 2017 22:12:35 +0000 (22:12 +0000)
committerVedant Kumar <vsk@apple.com>
Tue, 13 Jun 2017 22:12:35 +0000 (22:12 +0000)
commit9ed1dbec9b17abafe2ef33d4af79e792821e014c
tree3412593ada0f25242436ab718d0330eafddd1bb8
parent79ebf193fa12cc21a9d12c809b13189b45cb2530
[InstrProf] Don't take the address of alwaysinline available_externally functions

Doing so breaks compilation of the following C program
(under -fprofile-instr-generate):

 __attribute__((always_inline)) inline int foo() { return 0; }

 int main() { return foo(); }

At link time, we fail because taking the address of an
available_externally function creates an undefined external reference,
which the TU cannot provide.

Emitting the function definition into the object file at all appears to
be a violation of the langref: "Globals with 'available_externally'
linkage are never emitted into the object file corresponding to the LLVM
module."

Differential Revision: https://reviews.llvm.org/D34134

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305327 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/InstrProfiling.cpp
test/Instrumentation/InstrProfiling/always_inline.ll [new file with mode: 0644]