[all-commits] [llvm/llvm-project] 98a15d: [clang][CodeGen] Allow `memcpy` replace with trivi...

Antonio Frighetto via All-commits all-commits at lists.llvm.org
Wed Mar 27 15:56:01 PDT 2024


  Branch: refs/heads/release/18.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 98a15dd2d72879f91de2b807daea937a362e4237
      https://github.com/llvm/llvm-project/commit/98a15dd2d72879f91de2b807daea937a362e4237
  Author: Antonio Frighetto <me at antoniofrighetto.com>
  Date:   2024-03-27 (Wed, 27 Mar 2024)

  Changed paths:
    M clang/lib/CodeGen/CGDecl.cpp
    M clang/test/CodeGen/aapcs-align.cpp
    M clang/test/CodeGen/aapcs64-align.cpp
    M clang/test/CodeGen/attr-counted-by.c
    M clang/test/CodeGenCXX/auto-var-init.cpp
    M clang/test/CodeGenOpenCL/amdgpu-printf.cl
    M clang/test/OpenMP/bug54082.c

  Log Message:
  -----------
  [clang][CodeGen] Allow `memcpy` replace with trivial auto var init

When emitting the storage (or memory copy operations) for constant
initializers, the decision whether to split a constant structure or
array store into a sequence of field stores or to use `memcpy` is
based upon the optimization level and the size of the initializer.
In afe8b93ffdfef5d8879e1894b9d7dda40dee2b8d, we extended this by
allowing constants to be split when the array (or struct) type does
not match the type of data the address to the object (constant) is
expected to contain. This may happen when `emitStoresForConstant` is
called by `EmitAutoVarInit`, as the element type of the address gets
shrunk. When this occurs, let the initializer be split into a bunch
of stores only under `-ftrivial-auto-var-init=pattern`.

Fixes: https://github.com/llvm/llvm-project/issues/84178.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list