[llvm] [Attributor] Change allocation size and load/store offsets using AAPointerInfo for Alloca instructions and keep track of instructions causing an Access (PR #72029)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 7 21:50:46 PST 2025


================
@@ -13435,6 +13627,64 @@ struct AAAllocationInfoImpl : public AAAllocationInfo {
             A, this, IRP, DepClassTy::OPTIONAL, IsKnownNoCapture))
       return indicatePessimisticFixpoint();
 
+    const AAPrivatizablePtr *AAPrivatizablePtrI =
+        A.getOrCreateAAFor<AAPrivatizablePtr>(getIRPosition(), *this,
+                                              DepClassTy::OPTIONAL);
+
+    // If this allocation is privatizable we don't want to modify its allocation
+    // size.
+    // TODO: update AAPointerInfo to update bins once AAPrivitizable makes a
+    // change.
+    if (AAPrivatizablePtrI && (AAPrivatizablePtrI->isAssumedPrivatizablePtr() ||
+                               AAPrivatizablePtrI->isKnownPrivatizablePtr()))
+      return indicateOptimisticFixpoint();
+
+    // For all call sites, check if the called function can privatize the
+    // pointer.
+    for (Use &U : I->uses()) {
+      auto *CB = dyn_cast<CallBase>(U.getUser());
+      if (!CB)
+        continue;
+
+      unsigned ArgIdx = 0;
----------------
shiltian wrote:

This is effectively doing `A.checkForAllCallSites` manually w/o considering whether the call site is dead or not?

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


More information about the llvm-commits mailing list