[Mlir-commits] [llvm] [mlir] [IR][ModRef] Introduce `errno` memory location (PR #120783)
Antonio Frighetto
llvmlistbot at llvm.org
Mon Feb 10 07:38:59 PST 2025
================
@@ -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;
+ }
+ }
----------------
antoniofrighetto wrote:
> That one should not include Errno as well
You meant that we should include the memory effects of Errno, as Other doesn't affect Errno, correct?
https://github.com/llvm/llvm-project/pull/120783
More information about the Mlir-commits
mailing list