Assert on polymorphic pointer intrinsic param

Opaque pointers cannot be polymorphic on the pointed type given their
lack thereof. However they are currently accepted by tablegen but the
intrinsic signature verifier trips when verifying any further
polymorphic type because the opaque pointer codepath for pointers will
not push the pointed type in ArgTys.

This commit adds an assert to easily catch such cases instead of having
the generic signature match failure.

Reviewed By: #opaque-pointers, nikic

Differential Revision: https://reviews.llvm.org/D125764
This commit is contained in:
Thomas Preud'homme 2022-05-17 11:47:43 +01:00
parent 8e4c5d9902
commit 8c975eac34
1 changed files with 3 additions and 0 deletions

View File

@ -1495,6 +1495,9 @@ static bool matchIntrinsicType(
while (Infos.front().Kind == IITDescriptor::Pointer ||
Infos.front().Kind == IITDescriptor::Vector)
Infos = Infos.slice(1);
assert((Infos.front().Kind != IITDescriptor::Argument ||
Infos.front().getArgumentKind() == IITDescriptor::AK_MatchType) &&
"Unsupported polymorphic pointer type with opaque pointer");
Infos = Infos.slice(1);
return false;
}