efriedma-quic wrote: There are two possible alternative sequences we could generate there:
``` int test(int x, int y) { struct S s; __builtin_memset(&s, 0, 8); s.x = x; s.y = y; f(&s); } int test2(int x, int y) { struct S s; long long dummy = (unsigned char)x; __builtin_memcpy(&s, &dummy, 8); s.x = x; s.y = y; f(&s); } ``` Whether one of them is better might depend on the context... for test2, the zero-extend can be folded away in some cases. I'd prefer to handle this on the LLVM side if possible (memcpyopt, or something like that); it's probably tricky to catch all the relevant cases in clang. https://github.com/llvm/llvm-project/pull/97121 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits