[clang] [CIR] Rewrite a raised std::find over bytes into memchr (PR #212355)
Rithik Sharma via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 12 17:02:36 PDT 2026
SharmaRithik wrote:
Thanks Andy, Bruno, and Erich for the feedback! I just updated the PR.
- The size_t width now comes from a module attribute instead of the triple, and the target gate is an allow list instead of a list of exclusions, with a comment on each condition. The SPIRV and PS3 cases are gone.
- The rewrite declines when the module already has a memchr symbol, which was giving wrong code when that symbol carried noreturn or returns_nonnull( an empty range no longer forms the call).
- The nobuiltin helpers have a comment at each step (I kept them separate).
- On other size_t widths, cir.libc.memchr has pinned its length to u64 since the op was added and __builtin_memchr already fails on a 32 bit target because of it (so imo the fix belongs on the op).
https://github.com/llvm/llvm-project/pull/212355
More information about the cfe-commits
mailing list