[IR] Allow matching pointer to vector with opaque pointers.
authorHendrik Greving <hgreving@google.com>
Tue, 22 Mar 2022 02:20:53 +0000 (19:20 -0700)
committerHendrik Greving <hgreving@google.com>
Tue, 22 Mar 2022 16:34:48 +0000 (09:34 -0700)
Allows for skipping the pointer to vector type if opaque pointers
are enabled and the matching pointer is a vector pointer when
matching an intrinsic signature in the verifier.

No test added since lacking a target using intrinsic with pointer
to vector arguments.

Differential Revision: https://reviews.llvm.org/D122203

llvm/lib/IR/Function.cpp

index fa0fd5e..fcc0ef0 100644 (file)
@@ -1468,7 +1468,11 @@ static bool matchIntrinsicType(
         return matchIntrinsicType(PT->getNonOpaquePointerElementType(), Infos,
                                   ArgTys, DeferredChecks, IsDeferredCheck);
       // Consume IIT descriptors relating to the pointer element type.
-      while (Infos.front().Kind == IITDescriptor::Pointer)
+      // FIXME: Intrinsic type matching of nested single value types or even
+      // aggregates doesn't work properly with opaque pointers but hopefully
+      // doesn't happen in practice.
+      while (Infos.front().Kind == IITDescriptor::Pointer ||
+             Infos.front().Kind == IITDescriptor::Vector)
         Infos = Infos.slice(1);
       Infos = Infos.slice(1);
       return false;