[llvm] [ArgPromotion] Perform alias analysis on actual arguments of Calls (PR #106216)
Matthew Devereau via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 07:00:54 PDT 2024
================
@@ -485,11 +485,39 @@ static bool allCallersPassValidPointerForArgument(
});
}
+// Try to prove that all Calls to F do not modify the memory pointed to by Arg,
+// using alias analysis local to each caller of F.
+static bool isArgUnmodifiedByAllCalls(Function *F, unsigned ArgNo,
+ FunctionAnalysisManager &FAM) {
+ // Check if all Users of F are Calls which do not modify Arg.
+ for (User *U : F->users()) {
+
+ // Bail if we find an unexpected (non CallInst) use of the function.
+ auto *Call = dyn_cast<CallInst>(U);
+ if (!Call)
+ return false;
+
+ Value *ArgOp = Call->getArgOperand(ArgNo);
+ assert(ArgOp->getType()->isPointerTy() && "Argument must be Pointer Type!");
----------------
MDevereau wrote:
I don't think its possible for Arg to not be a pointer type at this stage, since `PointerArgs` in `promoteArguments`. I think this check can be deleted.
https://github.com/llvm/llvm-project/pull/106216
More information about the llvm-commits
mailing list