[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()) {
if (PtrArg != Arg) {
LLVM_DEBUG(dbgs() << "ArgPromotion of " << *Arg << " failed: "
<< "pointer offset is not equal to zero\n");
return false;
}
unsigned int ArgNo = Arg->getArgNo();
- if (CB->getArgOperand(ArgNo) != Arg || U->getOperandNo() != ArgNo) {
+ if (U->getOperandNo() != ArgNo) {
----------------
arsenm wrote:
Can you use isCallee?
https://github.com/llvm/llvm-project/pull/98657
More information about the llvm-commits
mailing list