[llvm] cfb1cb4 - [TTI] Make assertion compatible with opaque pointers
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 23 03:22:04 PDT 2021
Author: Nikita Popov
Date: 2021-06-23T12:21:54+02:00
New Revision: cfb1cb4491d7aac218d9fd903a69b46bbc21118b
URL: https://github.com/llvm/llvm-project/commit/cfb1cb4491d7aac218d9fd903a69b46bbc21118b
DIFF: https://github.com/llvm/llvm-project/commit/cfb1cb4491d7aac218d9fd903a69b46bbc21118b.diff
LOG: [TTI] Make assertion compatible with opaque pointers
Dropping the TODO here because it applies to all uses of this method.
Added:
Modified:
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
Removed:
################################################################################
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<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);
More information about the llvm-commits
mailing list