[clang] [llvm] [mlir] [InferAttrs] Mark errnomem-setting libcalls as such (PR #124742)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 07:46:32 PST 2025


================
@@ -128,6 +128,15 @@ static void addLocAccess(MemoryEffects &ME, const MemoryLocation &Loc,
     ME |= MemoryEffects::argMemOnly(MR);
     return;
   }
+  // TODO: This should be refined to use upcoming Loc.TBAAErrno for errno
+  // memory, rather than manually inspecting the underlying object.
+  if (isa<CallInst>(UO)) {
+    auto *Callee = cast<CallInst>(UO)->getCalledFunction();
+    if (Callee && Callee->getName() == "__errno_location") {
----------------
antoniofrighetto wrote:

Right, clang on Windows links against UCRT, which declares _errno. This has to be taken into account. 

https://github.com/llvm/llvm-project/pull/124742


More information about the llvm-commits mailing list