You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use inline assembly in strlen for vector loads (#593)
This commit is a refinement of #586 to use inline assembly to perform
vector loads instead of using a C-defined load. This is done to avoid UB
in LLVM where C cannot read either before or after an allocation. When
`strlen` is not inlined, as it currently isn't, then there's not really
any reasonable path that a compiler could prove that a load was
out-of-bounds so this is issue is unlikely in practice, but it
nevertheless is still UB. In the future the eventual goal is to move
these SIMD routines into header files to avoid needing multiple builds
of libc itself, and in such a situation inlining is indeed possible and
a compiler would be capable of much more easily seeing the UB which
could cause problems.
Inline assembly unfortunately doesn't work with vector output parameters
on Clang 19 and Clang 20 due to an ICE. This was fixed in
llvm/llvm-project#146574 for Clang 21, but it
means that the SIMD routines are now excluded with Clang 19 and Clang 20
to avoid compilation errors there.
0 commit comments