[llvm-branch-commits] [llvm] [MSAN] handle AVX vpermi2var (PR #143463)

Thurston Dang via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jun 13 15:19:19 PDT 2025


================
@@ -4191,6 +4191,15 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
   // We apply the same permutation (argument index 1) to the shadows.
   void handleAVXVpermil2var(IntrinsicInst &I) {
     assert(I.arg_size() == 3);
+    assert(isa<FixedVectorType>(I.getArgOperand(0)->getType()));
+    assert(isa<FixedVectorType>(I.getArgOperand(1)->getType()));
+    assert(isa<FixedVectorType>(I.getArgOperand(2)->getType()));
+    [[maybe_unused]] auto ArgVectorSize =
+        cast<FixedVectorType>(I.getArgOperand(0)->getType())->getNumElements();
+    assert(cast<FixedVectorType>(I.getArgOperand(1)->getType())
+               ->getNumElements() == ArgVectorSize);
+    assert(cast<FixedVectorType>(I.getArgOperand(2)->getType())
+               ->getNumElements() == ArgVectorSize);
----------------
thurstond wrote:

Some of the assertions are redundant (e.g., if operand 0 is a vector, and operand 0's type is the same as operand 2's type, then operand 2 must be a vector with the same number of elements as operand 0), but that's fine.

https://github.com/llvm/llvm-project/pull/143463


More information about the llvm-branch-commits mailing list