[PATCH] D125764: Assert on polymorphic pointer intrinsic param

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 04:03:58 PDT 2022


thopre created this revision.
thopre added reviewers: opaque-pointers, nikic, dexonsmith, aeubanks.
Herald added a subscriber: hiraditya.
Herald added a project: All.
thopre requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125764

Files:
  llvm/lib/IR/Function.cpp


Index: llvm/lib/IR/Function.cpp
===================================================================
--- llvm/lib/IR/Function.cpp
+++ llvm/lib/IR/Function.cpp
@@ -1495,6 +1495,8 @@
       while (Infos.front().Kind == IITDescriptor::Pointer ||
              Infos.front().Kind == IITDescriptor::Vector)
         Infos = Infos.slice(1);
+      assert(Infos.front().Kind != IITDescriptor::Argument &&
+             "Unsupported polymorphic pointer type with opaque pointer");
       Infos = Infos.slice(1);
       return false;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125764.429996.patch
Type: text/x-patch
Size: 531 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220517/994bb87d/attachment.bin>


More information about the llvm-commits mailing list