[llvm] [ArgPromotion] Handle pointer arguments of recursive calls (PR #78735)

Vedant Paranjape via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 19:49:14 PDT 2024


================
@@ -610,13 +610,78 @@ static bool findArgParts(Argument *Arg, const DataLayout &DL, AAResults &AAR,
       // unknown users
     }
 
+    auto *CB = dyn_cast<CallBase>(V);
+    Value *PtrArg = dyn_cast<Value>(U);
+    if (IsRecursive && CB && PtrArg) {
+      Type *PtrTy = PtrArg->getType();
----------------
vedantparanjape-amd wrote:

Yes, but for a first try it seems okay to do. It's not exactly same as HandleEndUser. Mainly the issue is that some checks in that functor like (below) fail for CallIBase objects.

```cpp
    TypeSize Size = DL.getTypeStoreSize(Ty);
    // Don't try to promote scalable types.
    if (Size.isScalable())
      return false;
``` 

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


More information about the llvm-commits mailing list