[all-commits] [llvm/llvm-project] 2d1b55: [CodeGen] Make element type in emitArrayDestroy() ...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Jan 11 00:25:45 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2d1b55ebea88547d153fcd980b88c946cffc5ca5
      https://github.com/llvm/llvm-project/commit/2d1b55ebea88547d153fcd980b88c946cffc5ca5
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-01-11 (Tue, 11 Jan 2022)

  Changed paths:
    M clang/lib/CodeGen/CGDecl.cpp
    M clang/lib/CodeGen/CGDeclCXX.cpp
    M clang/test/CodeGenCXX/global-array-destruction.cpp

  Log Message:
  -----------
  [CodeGen] Make element type in emitArrayDestroy() predictable

When calling emitArrayDestroy(), the pointer will usually have
ConvertTypeForMem(EltType) as the element type, as one would expect.
However, globals with initializers sometimes don't use the same
types as values normally would, e.g. here the global uses
{ double, i32 } rather than %struct.T as element type.

Add an early cast to the global destruction path to avoid this
special case. The cast would happen lateron anyway, it only gets
moved to an earlier point.

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




More information about the All-commits mailing list