Index: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h =================================================================== --- llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h +++ llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h @@ -163,8 +163,7 @@ TTI::TargetCostKind CostKind, const Instruction *I = nullptr); - bool isExtPartOfAvgExpr(const Instruction *ExtUser, const CastInst *Ext, - Type *Dst, Type *Src); + bool isExtPartOfAvgExpr(const Instruction *ExtUser, Type *Dst, Type *Src); InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, Index: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp =================================================================== --- llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -2050,10 +2050,8 @@ // %y = (zext i8 -> i16) // trunc i16 (lshr (add %x, %y), 1) -> i8 // -bool AArch64TTIImpl::isExtPartOfAvgExpr(const Instruction *ExtUser, - const CastInst *Ext, Type *Dst, +bool AArch64TTIImpl::isExtPartOfAvgExpr(const Instruction *ExtUser, Type *Dst, Type *Src) { - // The source should be a legal vector type. if (!Src->isVectorTy() || !TLI->isTypeLegal(TLI->getValueType(DL, Src)) || (Src->isScalableTy() && !ST->hasSVE2())) @@ -2121,7 +2119,7 @@ // The cast will be free for the s/urhadd instructions if ((isa(I) || isa(I)) && - isExtPartOfAvgExpr(SingleUser, cast(I), Dst, Src)) + isExtPartOfAvgExpr(SingleUser, Dst, Src)) return 0; }