[PATCH] D102842: [Verifier] Fail on invalid indices for {insert,extract} vector intrinsics

Joe Ellis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 1 03:11:48 PDT 2021


joechrisellis marked an inline comment as done.
joechrisellis added inline comments.


================
Comment at: llvm/lib/IR/Verifier.cpp:5314
+
+    Assert(VecTy == ResultTy,
+           "experimental_vector_insert vector type must match result type.");
----------------
david-arm wrote:
> Hi @joechrisellis could you add a verifier test for this new Assert too?
Thanks for pointing this out -- turns out that this assertion is unnecessary because the intrinsic is defined like so:

```
def int_experimental_vector_insert : DefaultAttrsIntrinsic<[llvm_anyvector_ty],
                                                           [LLVMMatchType<0>, llvm_anyvector_ty, llvm_i64_ty],
                                                           [IntrNoMem, ImmArg<ArgIndex<2>>]>;
```

The `LLVMMatchType` here means that the constraint described by this assertion is already enforced -- there must be an existing mechanism that does this for the intrinsics.

I'll remove this assertion. I think it's safe to assume that the generic checking mechanism for `LLVMMatchType` is already tested, so no need to add additional tests. 😄 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102842/new/

https://reviews.llvm.org/D102842



More information about the llvm-commits mailing list