================ @@ -970,6 +971,19 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call, } ModRefInfo Result = ArgMR | OtherMR; + + // Refine writes to errno memory. We can safely exclude the errno location if + // the given memory location is an alloca, the size of the memory access is + // larger than `sizeof(int)` or if TBAA proves it does not alias errno. + if ((ErrnoMR | OtherMR) != OtherMR) { + bool IsLocSizeUnknown = Loc.Size == MemoryLocation::UnknownSize; + if (ErrnoMR == ModRefInfo::Mod && !isa<AllocaInst>(Object) && + (IsLocSizeUnknown || + (!IsLocSizeUnknown && Loc.Size.getValue() <= sizeof(int))) && ---------------- nikic wrote:
Should not use `sizeof(int)` here, which is a host property. We should query the `int` size from TLI instead. https://github.com/llvm/llvm-project/pull/125258 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits