[llvm] [BasicAA][TLI] Treat local-linkage globals or known environments as not aliasing errno (PR #170290)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 08:28:46 PST 2025


================
@@ -1001,7 +1001,10 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call,
 
   // Refine accesses to errno memory.
   if ((ErrnoMR | Result) != Result) {
-    if (AAQI.AAR.aliasErrno(Loc, Call->getModule()) != AliasResult::NoAlias) {
+    // Do not make any assumptions about errno on freestanding environments.
+    bool IsFreestanding = Call->getFunction()->hasFnAttribute("no-builtins");
----------------
antoniofrighetto wrote:

The rework of aliasErrno signatures sort of prevented me from checking it closer to isErrnoFunctionCall, though agree it's best suitable there.

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


More information about the llvm-commits mailing list