[llvm] [ArgPromotion] Remove redundant logic from recursive argpromotion code (PR #98657)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 09:47:24 PDT 2024


================
@@ -640,16 +640,18 @@ static bool findArgParts(Argument *Arg, const DataLayout &DL, AAResults &AAR,
     }
 
     auto *CB = dyn_cast<CallBase>(V);
-    Value *PtrArg = cast<Value>(U);
-    if (CB && PtrArg && CB->getCalledFunction() == CB->getFunction()) {
+    Value *PtrArg = U->get();
+    if (CB && CB->getCalledFunction() == CB->getFunction() &&
+        CB->getCalledFunction()->getReturnType() ==
+            CB->getFunction()->getReturnType()) {
----------------
arsenm wrote:

Why is the function return type important? getCalledFunction is supposed to return null if the function types mismatch already? 

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


More information about the llvm-commits mailing list