[clang] [llvm] [clang][CodeGen][AA] Add `!llvm.errno.tbaa` gathering int-compatible TBAA nodes (PR #125258)
John McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed May 28 11:18:40 PDT 2025
rjmccall wrote:
> Oh, sorry for not providing context earlier. The reasoning behind is to allow certain optimizations involving errno-writing libcalls (marked as `memory(errnomem: write)`) to occur, if we are able to prove the involved memory location does not alias errno (e.g., because we are accessing a float-typed pointer). IIUC, in standard C, errno is an int, so all legitimate accesses must use int-compatible types (or otherwise violating strict aliasing). Hence, we should be able to leverage TBAA and prove not aliasing with errno, if we do not alias for any nodes belonging to `!llvm.errno.tbaa` (which is presumably gathering all int-based nodes; this should require confirmation).
I see. So the idea here is *not* that we're changing the TBAA nodes used for any actual accesses. Instead, we're using a named global metadata to specify the TBAA node that all `errno` accesses would use so that LLVM can do alias analysis around these libcalls (presumably to allow load/store optimization across them). That makes a lot of sense, thanks for the clarification. Please update your commit messages and PR title and description; I think if you re-read them, you're see that they sound as if you're trying to change how accesses to `errno` are annotated. In the meantime, I think I have the context to review the PR now.
https://github.com/llvm/llvm-project/pull/125258
More information about the cfe-commits
mailing list