[llvm-branch-commits] [clang] [flang] [llvm] [OpenMP][Attributor] Infer noalias for host callback captures (PR #218453)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Sep 21 03:24:43 PDT 2026


================
@@ -5627,10 +5627,27 @@ void OpenMPOpt::registerAAs(bool IsModulePass) {
     }
   }
 
+  // Seed the generic noalias deduction for callback-mapped pointer arguments
+  // in host regions. It will inspect every callback and direct call site before
+  // manifesting the attribute.
+  if (!isOpenMPDevice(M)) {
+    for (Function *F : SCC) {
+      if (F->isDeclaration())
+        continue;
+      for (Use &U : F->uses()) {
+        AbstractCallSite ACS(&U);
+        if (!ACS || !ACS.isCallbackCall())
+          continue;
+        for (Argument &Arg : F->args())
+          if (Arg.getType()->isPointerTy() && ACS.getCallArgOperandNo(Arg) >= 0)
+            A.getOrCreateAAFor<AANoAlias>(IRPosition::argument(Arg));
----------------
arsenm wrote:

I don't expect to see a new loop through the program to add new AAs

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


More information about the llvm-branch-commits mailing list