[llvm] [FunctionAttrs] Add `errno` inference logic (PR #129067)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 08:01:21 PST 2025
================
@@ -118,16 +118,31 @@ static void addLocAccess(MemoryEffects &ME, const MemoryLocation &Loc,
ModRefInfo MR, AAResults &AAR) {
// Ignore accesses to known-invariant or local memory.
MR &= AAR.getModRefInfoMask(Loc, /*IgnoreLocal=*/true);
- if (isNoModRef(MR))
+ if (isNoModRef(MR)) {
+ // Mask out errno, can never alias this known-invariant memory location.
+ ME -= ME.errnoMemOnly();
return;
+ }
const Value *UO = getUnderlyingObjectAggressive(Loc.Ptr);
- if (isa<AllocaInst>(UO))
+ if (isa<AllocaInst>(UO)) {
+ ME -= ME.errnoMemOnly();
----------------
nikic wrote:
I don't understand what is going on here. You're saying that any function that accesses an alloca doesn't accesses errno?
Generally, it doesn't make sense to mask out something from ME after the fact.
https://github.com/llvm/llvm-project/pull/129067
More information about the llvm-commits
mailing list