aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index bfe09da..1fb46af 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -2783,9 +2783,9 @@ Instruction *InstCombinerImpl::visitCallBase(CallBase &Call) {
PointerType *NewTy = cast<PointerType>(CI->getOperand(0)->getType());
if (!NewTy->isOpaque() && Call.isByValArgument(ix)) {
Call.removeParamAttr(ix, Attribute::ByVal);
- Call.addParamAttr(
- ix, Attribute::getWithByValType(
- Call.getContext(), NewTy->getPointerElementType()));
+ Call.addParamAttr(ix, Attribute::getWithByValType(
+ Call.getContext(),
+ NewTy->getNonOpaquePointerElementType()));
}
Changed = true;
}
@@ -3052,17 +3052,14 @@ bool InstCombinerImpl::transformConstExprCastCall(CallBase &Call) {
// If the callee is just a declaration, don't change the varargsness of the
// call. We don't want to introduce a varargs call where one doesn't
// already exist.
- PointerType *APTy = cast<PointerType>(Call.getCalledOperand()->getType());
- if (FT->isVarArg()!=cast<FunctionType>(APTy->getPointerElementType())->isVarArg())
+ if (FT->isVarArg() != Call.getFunctionType()->isVarArg())
return false;
// If both the callee and the cast type are varargs, we still have to make
// sure the number of fixed parameters are the same or we have the same
// ABI issues as if we introduce a varargs call.
- if (FT->isVarArg() &&
- cast<FunctionType>(APTy->getPointerElementType())->isVarArg() &&
- FT->getNumParams() !=
- cast<FunctionType>(APTy->getPointerElementType())->getNumParams())
+ if (FT->isVarArg() && Call.getFunctionType()->isVarArg() &&
+ FT->getNumParams() != Call.getFunctionType()->getNumParams())
return false;
}