[all-commits] [llvm/llvm-project] 054cc3: [CUDA][HIP] Fix store of vtbl in ctor

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Tue Jun 8 07:25:53 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 054cc3b1b469de4b0cb25d1dc3af43c679c5dc44
      https://github.com/llvm/llvm-project/commit/054cc3b1b469de4b0cb25d1dc3af43c679c5dc44
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2021-06-08 (Tue, 08 Jun 2021)

  Changed paths:
    M clang/lib/CodeGen/CGClass.cpp
    A clang/test/CodeGenCUDA/vtbl.cu

  Log Message:
  -----------
  [CUDA][HIP] Fix store of vtbl in ctor

vtbl itself is in default global address space. When clang emits
ctor, it gets a pointer to the vtbl field based on the this pointer,
then stores vtbl to the pointer.

Since this pointer can point to any address space (e.g. an object
created in stack), this pointer points to default address space, therefore
the pointer to vtbl field in this object should also be in default
address space.

Currently, clang incorrectly casts the pointer to vtbl field in this object
to global address space. This caused assertions in backend.

This patch fixes that by removing the incorrect addr space cast.

Reviewed by: Artem Belevich

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




More information about the All-commits mailing list