teak-llvm/clang/lib/Serialization
Michael Liao 243ebfba17 [hip][cuda] Fix the extended lambda name mangling issue.
Summary:
- HIP/CUDA host side needs to use device kernel symbol name to match the
  device side binaries. Without a consistent naming between host- and
  device-side compilations, it's risky that wrong device binaries are
  executed. Consistent naming is usually not an issue until unnamed
  types are used, especially the lambda. In this patch, the consistent
  name mangling is addressed for the extended lambdas, i.e. the lambdas
  annotated with `__device__`.
- In [Itanium C++ ABI][1], the mangling of the lambda is generally
  unspecified unless, in certain cases, ODR rule is required to ensure
  consisent naming cross TUs. The extended lambda is such a case as its
  name may be part of a device kernel function, e.g., the extended
  lambda is used as a template argument and etc. Thus, we need to force
  ODR for extended lambdas as they are referenced in both device- and
  host-side TUs. Furthermore, if a extended lambda is nested in other
  (extended or not) lambdas, those lambdas are required to follow ODR
  naming as well. This patch revises the current lambda mangle numbering
  to force ODR from an extended lambda to all its parent lambdas.
- On the other side, the aforementioned ODR naming should not change
  those lambdas' original linkages, i.e., we cannot replace the original
  `internal` with `linkonce_odr`; otherwise, we may violate ODR in
  general. This patch introduces a new field `HasKnownInternalLinkage`
  in lambda data to decouple the current linkage calculation based on
  mangling number assigned.

[1]: https://itanium-cxx-abi.github.io/cxx-abi/abi.html

Reviewers: tra, rsmith, yaxunl, martong, shafik

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 375309
2019-10-19 00:15:19 +00:00
..
ASTCommon.cpp Add SVE opaque built-in types 2019-08-09 08:52:54 +00:00
ASTCommon.h [OPENMP 5.0]Add initial support for 'allocate' directive. 2019-03-07 17:54:44 +00:00
ASTReader.cpp [OPENMP]Allow priority clause in combined task-based directives. 2019-10-16 18:09:37 +00:00
ASTReaderDecl.cpp [hip][cuda] Fix the extended lambda name mangling issue. 2019-10-19 00:15:19 +00:00
ASTReaderInternals.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ASTReaderStmt.cpp [c++20] Add CXXRewrittenBinaryOperator to represent a comparison 2019-10-19 00:04:38 +00:00
ASTWriter.cpp [hip][cuda] Fix the extended lambda name mangling issue. 2019-10-19 00:15:19 +00:00
ASTWriterDecl.cpp [Concept] Associated Constraints Infrastructure 2019-10-15 18:44:06 +00:00
ASTWriterStmt.cpp [c++20] Add CXXRewrittenBinaryOperator to represent a comparison 2019-10-19 00:04:38 +00:00
CMakeLists.txt [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
GeneratePCH.cpp [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
GlobalModuleIndex.cpp [Support] Add overload writeFileAtomically(std::function Writer) 2019-09-13 20:08:27 +00:00
InMemoryModuleCache.cpp Modules: Invalidate out-of-date PCMs as they're discovered 2019-03-09 17:44:01 +00:00
Module.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ModuleFileExtension.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ModuleManager.cpp FileManager: Remove ShouldCloseOpenFile argument from getBufferForFile, NFC 2019-08-30 16:56:26 +00:00
MultiOnDiskHashTable.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
PCHContainerOperations.cpp [Clang] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:04:18 +00:00