[clang] [clang][CodeGen] Zero init unspecified fields in initializers in C (PR #97121)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 12:17:22 PDT 2024


yabinc wrote:

I am not sure if it is worth using Store instead of memset for 8 bytes or fewer, as below:
`  if (BitSize <= 64) {
    Builder.CreateStore(Builder.getIntN(BitSize, 0), Addr);
  }`

As shown in https://godbolt.org/z/PEW1zxc1G, memset is not optimized away in -O2 -emit-llvm, but it is optimized to stores in the arm64/x86_64 backend with -O2.


https://github.com/llvm/llvm-project/pull/97121


More information about the cfe-commits mailing list