From cfb1cb4491d7aac218d9fd903a69b46bbc21118b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 23 Jun 2021 12:21:12 +0200 Subject: [PATCH] [TTI] Make assertion compatible with opaque pointers Dropping the TODO here because it applies to all uses of this method. --- llvm/include/llvm/Analysis/TargetTransformInfoImpl.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h index dfedba6..2e9e27f 100644 --- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h +++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h @@ -857,9 +857,8 @@ public: 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); -- 2.7.4