[llvm] [AA] Refine ModRefInfo taking into account `errnomem` location (PR #157495)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 16 07:58:23 PDT 2025
================
@@ -997,6 +998,19 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call,
}
ModRefInfo Result = ArgMR | OtherMR;
+
+ // Refine accesses to errno memory. We can safely exclude the errno location
+ // if the given memory location is an identified function-local object, the
+ // size of the memory access is larger than the integer size, or if TBAA
+ // proves it does not alias errno.
+ if ((ErrnoMR | Result) != Result) {
+ if (isModOrRefSet(ErrnoMR) && !isIdentifiedFunctionLocal(Object) &&
----------------
nikic wrote:
I don't think the isModOrRefSet() check is needed, it is already covered by `(ErrnoMR | Result) != Result`.
Also I think the isIdentifiedFunctionLocal() check belongs inside aliasErrno(). This will repeat the getUnderlyingObject() call, but from a quick test (with this commit: https://github.com/llvm/llvm-project/commit/60cab1e6058303a41a361f12ddf3c3ab4649bae5) this doesn't seem to affect compile-time, so I think it's fine.
https://github.com/llvm/llvm-project/pull/157495
More information about the llvm-commits
mailing list