Skip to content

Commit 9855319

Browse files
committed
[ArgPromotion] Consider InvokeInst in Caller alias analysis
Check that all users of a Function are CallBase rather than CallInst when performing alias analysis using actual arguments in the calling function, as this check is also valid for Invoke instructions. This allows replacing the existing check with an assert, as the Function only being used by CallBase derived instructions is a precondition of the transform. This addresses post-commit review on llvm#106216.
1 parent 1c26e2b commit 9855319

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/Transforms/IPO/ArgumentPromotion.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,8 @@ static bool isArgUnmodifiedByAllCalls(Argument *Arg,
491491
FunctionAnalysisManager &FAM) {
492492
for (User *U : Arg->getParent()->users()) {
493493

494-
// Bail if we find an unexpected (non CallInst) use of the function.
495-
auto *Call = dyn_cast<CallInst>(U);
496-
if (!Call)
497-
return false;
494+
assert(isa<CallBase>(U) && "Expected all users of Function to be CallBase");
495+
CallBase *Call = cast<CallBase>(U);
498496

499497
MemoryLocation Loc =
500498
MemoryLocation::getForArgument(Call, Arg->getArgNo(), nullptr);

0 commit comments

Comments
 (0)