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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 06:13:06 PDT 2024


================
@@ -610,13 +610,59 @@ static bool findArgParts(Argument *Arg, const DataLayout &DL, AAResults &AAR,
       // unknown users
     }
 
+    if (IsSelfRecursive && isa<CallBase>(V)) {
+      Value *Ptr = dyn_cast<Value>(U);
+      Type *PtrTy = Ptr->getType();
+      Align PtrAlign = Ptr->getPointerAlignment(DL);
+      APInt Offset(DL.getIndexTypeSizeInBits(Ptr->getType()), 0);
+      Ptr = Ptr->stripAndAccumulateConstantOffsets(DL, Offset,
+                                                    /* AllowNonInbounds */ true);
----------------
arsenm wrote:

```suggestion
                                                    /* AllowNonInbounds= */ true);
```

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


More information about the llvm-commits mailing list