[InstCombine] Use getFunctionType()

Avoid fetching pointer element type...
This commit is contained in:
Nikita Popov 2021-06-22 22:29:05 +02:00
parent dbbc8d8333
commit 8321335fd8
2 changed files with 10 additions and 2 deletions

View File

@ -2310,8 +2310,7 @@ Instruction *InstCombinerImpl::visitCallBase(CallBase &Call) {
if (IntrinsicInst *II = findInitTrampoline(Callee))
return transformCallThroughTrampoline(Call, *II);
PointerType *PTy = cast<PointerType>(Callee->getType());
FunctionType *FTy = cast<FunctionType>(PTy->getElementType());
FunctionType *FTy = Call.getFunctionType();
if (FTy->isVarArg()) {
int ix = FTy->getNumParams();
// See if we can optimize any arguments passed through the varargs area of

View File

@ -108,3 +108,12 @@ define ptr @load_bitcast_2(ptr %a) {
%d = bitcast i8* %c to ptr
ret ptr %d
}
define void @call(ptr %a) {
; CHECK-LABEL: @call(
; CHECK-NEXT: call void [[A:%.*]]()
; CHECK-NEXT: ret void
;
call void %a()
ret void
}