[TTI] Make assertion compatible with opaque pointers

Dropping the TODO here because it applies to all uses of this method.
This commit is contained in:
Nikita Popov 2021-06-23 12:21:12 +02:00
parent 3ee6f1a4fa
commit cfb1cb4491
1 changed files with 2 additions and 3 deletions

View File

@ -857,9 +857,8 @@ public:
ArrayRef<const Value *> 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<PointerType>(Ptr->getType()->getScalarType())
->isOpaqueOrPointeeTypeMatches(PointeeType) &&
"explicit pointee type doesn't match operand's pointee type");
auto *BaseGV = dyn_cast<GlobalValue>(Ptr->stripPointerCasts());
bool HasBaseReg = (BaseGV == nullptr);