================ @@ -126,8 +126,21 @@ static void addLocAccess(MemoryEffects &ME, const MemoryLocation &Loc, return; if (isa<Argument>(UO)) { ME |= MemoryEffects::argMemOnly(MR); + if (Loc.Size <= LocationSize::precise(sizeof(int))) + ME |= MemoryEffects::errnoMemOnly(MR); return; } + if (isa<CallInst>(UO)) { + static constexpr auto ErrnoFnNames = {"__errno_location", "_errno", + "__errno", "___errno"}; + auto *Callee = cast<CallInst>(UO)->getCalledFunction(); + if (Callee && llvm::any_of(ErrnoFnNames, [&](const auto Fn) { + return Fn == Callee->getName(); + })) { + ME |= MemoryEffects::errnoMemOnly(MR); + return; + } + } ---------------- nikic wrote:
Note that the bit you actually *want* to modify the the code a few lines below that uses IRMemLocation::Other. That one should not include Errno as well. https://github.com/llvm/llvm-project/pull/120783 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits