llvm-project/clang/lib
Evgeniy Stepanov 93db40a147 Always_inline codegen rewrite.
Current implementation may end up emitting an undefined reference for
an "inline __attribute__((always_inline))" function by generating an
"available_externally alwaysinline" IR function for it and then failing to
inline all the calls. This happens when a call to such function is in dead
code. As the inliner is an SCC pass, it does not process dead code.

Libc++ relies on the compiler never emitting such undefined reference.

With this patch, we emit a pair of
1. internal alwaysinline definition (called F.alwaysinline)
2a. A stub F() { musttail call F.alwaysinline }
  -- or, depending on the linkage --
2b. A declaration of F.

The frontend ensures that F.inlinefunction is only used for direct
calls, and the stub is used for everything else (taking the address of
the function, really). Declaration (2b) is emitted in the case when
"inline" is meant for inlining only (like __gnu_inline__ and some
other cases).

This approach, among other nice properties, ensures that alwaysinline
functions are always internal, making it impossible for a direct call
to such function to produce an undefined symbol reference.

This patch is based on ideas by Chandler Carruth and Richard Smith.

llvm-svn: 247494
2015-09-12 01:07:37 +00:00
..
ARCMigrate Fix a small bug in clang where generating some temporary files would have an extra period before the extension. 2015-09-09 16:48:47 +00:00
AST [OPENMP] Fix printing of array section with single index. 2015-09-11 04:54:28 +00:00
ASTMatchers Fixed HasDeclarationMatcher to properly convert all types into decls where possible. Added objcObjectPointerType(), objcInterfaceDecl(), templateTypeParmType(), injectedClassNameType(), and unresolvedUsingTypenameDecl(). Updated documentation for pointerType() to call out that it does not match ObjCObjectPointerType types. Changed pointsTo() to handle ObjCObjectPointerType as well as PointerType. 2015-09-11 11:51:24 +00:00
Analysis Thread safety analysis: the NO_THREAD_SAFETY_ANALYSIS attribute will now 2015-09-03 21:14:22 +00:00
Basic Re-commit r247218: "Fix Clang-tidy misc-use-override warnings, other minor fixes" 2015-09-10 17:07:54 +00:00
CodeGen Always_inline codegen rewrite. 2015-09-12 01:07:37 +00:00
Driver [Shave]: pass -isystem dirs and "-Wa," args to moviAsm 2015-09-11 21:13:46 +00:00
Edit [Edit] Fix issue with tracking what macro argument inputs have been edited. 2015-09-11 20:09:11 +00:00
Format Re-commit r247218: "Fix Clang-tidy misc-use-override warnings, other minor fixes" 2015-09-10 17:07:54 +00:00
Frontend [CUDA] Postprocess bitcode linked in during device-side CUDA compilation. 2015-09-10 18:24:23 +00:00
FrontendTool Provide a BuryPointer for unique_ptrs. 2014-08-29 16:53:14 +00:00
Headers [X86][SSE] Add _mm_undefined_* intrinsics 2015-08-26 21:17:12 +00:00
Index Remove and forbid raw_svector_ostream::flush() calls. 2015-08-13 18:12:56 +00:00
Lex Add a -gmodules option to the driver and a -dwarf-ext-refs to cc1 2015-08-27 19:46:20 +00:00
Parse [OPENMP 4.1] Parsing/sema analysis for extended format of 'if' clause. 2015-09-03 07:23:48 +00:00
Rewrite Make local function isWhitespaceExceptNL static instead of in anonymous namespace 2015-07-28 04:54:03 +00:00
Sema [modules] When picking one of two template declarations as a lookup result, 2015-09-11 22:39:35 +00:00
Serialization [modules] Slightly defang an assert that produces false-positives on the selfhost bot. 2015-09-11 02:22:03 +00:00
StaticAnalyzer [Static Analyzer] Properly cash the configuration option for lambda support. 2015-09-11 21:19:39 +00:00
Tooling [tooling] In CompileCommand, Expose the 'file' that was associated with the command. 2015-09-11 20:43:05 +00:00
CMakeLists.txt Fix build with various feature flag combinations 2014-07-14 22:17:22 +00:00
Makefile Make clang's rewrite engine a core feature 2014-07-16 16:48:33 +00:00