diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h index dfedba63a807d..2e9e27fcb86ee 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -857,9 +857,8 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase { ArrayRef Operands, TTI::TargetCostKind CostKind = TTI::TCK_SizeAndLatency) { assert(PointeeType && Ptr && "can't get GEPCost of nullptr"); - // TODO: will remove this when pointers have an opaque type. - assert(Ptr->getType()->getScalarType()->getPointerElementType() == - PointeeType && + assert(cast(Ptr->getType()->getScalarType()) + ->isOpaqueOrPointeeTypeMatches(PointeeType) && "explicit pointee type doesn't match operand's pointee type"); auto *BaseGV = dyn_cast(Ptr->stripPointerCasts()); bool HasBaseReg = (BaseGV == nullptr);