[libc-commits] [libc] [libc] Keep the clang_vector string loads observable to the compiler (PR #236612)
Mike Lothian via libc-commits
libc-commits at lists.llvm.org
Tue Nov 3 04:46:19 PST 2026
FireBurn wrote:
I tried to make this the canonical way to read past a value. `aligned_base()` passes the pointer through an empty asm with a memory clobber, which keeps the stores into a known object, and then through a second asm to hide the aligned address. Both vector loads use it, and it replaces the `__builtin_object_size` fallback. `strlen` and `find_first_character` on a local array and on an array in another file are right at -O0, -O2 and -O3 with thin LTO, where they were wrong before, and a microbenchmark shows no change in speed. `memset_explicit` already uses the same asm. Other builtins that read past a value could use the helper too
https://github.com/llvm/llvm-project/pull/236612
More information about the libc-commits
mailing list