[llvm] 8c975ea - Assert on polymorphic pointer intrinsic param
Thomas Preud'homme via llvm-commits
llvm-commits at lists.llvm.org
Wed May 18 06:35:56 PDT 2022
Author: Thomas Preud'homme
Date: 2022-05-18T14:35:49+01:00
New Revision: 8c975eac34347aec1911a90ca07926f1d6325d8a
URL: https://github.com/llvm/llvm-project/commit/8c975eac34347aec1911a90ca07926f1d6325d8a
DIFF: https://github.com/llvm/llvm-project/commit/8c975eac34347aec1911a90ca07926f1d6325d8a.diff
LOG: 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
Added:
Modified:
llvm/lib/IR/Function.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 87a07702aa571..c7186a7227756 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -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;
}
More information about the llvm-commits
mailing list