summaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/IPO/ArgumentPromotion.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/ArgumentPromotion.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index 93bb11433775..3a42a2cac928 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -835,14 +835,20 @@ bool ArgumentPromotionPass::areFunctionArgsABICompatible(
const Function &F, const TargetTransformInfo &TTI,
SmallPtrSetImpl<Argument *> &ArgsToPromote,
SmallPtrSetImpl<Argument *> &ByValArgsToTransform) {
+ // TODO: Check individual arguments so we can promote a subset?
+ SmallVector<Type *, 32> Types;
+ for (Argument *Arg : ArgsToPromote)
+ Types.push_back(Arg->getType()->getPointerElementType());
+ for (Argument *Arg : ByValArgsToTransform)
+ Types.push_back(Arg->getParamByValType());
+
for (const Use &U : F.uses()) {
CallBase *CB = dyn_cast<CallBase>(U.getUser());
if (!CB)
return false;
const Function *Caller = CB->getCaller();
const Function *Callee = CB->getCalledFunction();
- if (!TTI.areFunctionArgsABICompatible(Caller, Callee, ArgsToPromote) ||
- !TTI.areFunctionArgsABICompatible(Caller, Callee, ByValArgsToTransform))
+ if (!TTI.areTypesABICompatible(Caller, Callee, Types))
return false;
}
return true;