[all-commits] [llvm/llvm-project] 11d3e3: [CUDA][HIP] Fix mangling number for local struct

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Thu Apr 28 16:55:32 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 11d3e31c60bdc9e491c51b97a964b6289575edfa
      https://github.com/llvm/llvm-project/commit/11d3e31c60bdc9e491c51b97a964b6289575edfa
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2022-04-28 (Thu, 28 Apr 2022)

  Changed paths:
    M clang/include/clang/AST/ASTContext.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/MicrosoftCXXABI.cpp
    M clang/lib/CodeGen/CGCUDANV.cpp
    A clang/test/CodeGenCUDA/struct-mangling-number.cu

  Log Message:
  -----------
  [CUDA][HIP] Fix mangling number for local struct

MSVC and Itanium mangling use different mangling numbers
for function-scope structs, which causes inconsistent
mangled kernel names in device and host compilations.

This patch uses Itanium mangling number for structs
in for mangling device side names in CUDA/HIP host
compilation on Windows to fix this issue.

A state is added to ASTContext to indicate whether the
current name mangling is for device side names in host
compilation. Device and host mangling number
are encoded/decoded as upper and lower half of 32 bit
unsigned integer to fit into the original mangling number
field for AST. Diagnostic will be emitted if a manglining
number exceeds limit.

Reviewed by: Artem Belevich, Reid Kleckner

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

Fixes: SWDEV-328515




More information about the All-commits mailing list