[llvm] ed0f407 - [LLVM][TableGen] Check validity of IIT encoding for vector types (#111152)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 09:25:42 PDT 2024


Author: Rahul Joshi
Date: 2024-10-04T09:25:39-07:00
New Revision: ed0f4074eb86f1588efb11bd06ad4fb383a9a921

URL: https://github.com/llvm/llvm-project/commit/ed0f4074eb86f1588efb11bd06ad4fb383a9a921
DIFF: https://github.com/llvm/llvm-project/commit/ed0f4074eb86f1588efb11bd06ad4fb383a9a921.diff

LOG: [LLVM][TableGen] Check validity of IIT encoding for vector types (#111152)

Add assert to verify that the `IIT_Vecs` list for IIT encoding of vector
types is not empty for vector types (else it will generate an invalid
IIT encoding).

Remove `llvm_v2048i1_ty` for which this assert fails, since the
`Intrinsics.td` file does not define any IIT encoding for vectors of
size 2048.

Added: 
    

Modified: 
    llvm/include/llvm/IR/Intrinsics.td

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 1e243eb27b312a..20dd921ddbd230 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -372,6 +372,10 @@ class LLVMType<ValueType vt> {
     []);
   assert !le(!size(IIT_Vecs), 1), "Duplicate type";
 
+  // For vector types, assert that the IIT_Vecs list is not empty.
+  assert !or(!not(vt.isVector), !not(!empty(IIT_Vecs))),
+         "Invalid IIT encoding for vector type v" # vt.nElem # vt.ElementType;
+
   list<int> Sig = !listconcat(
     !if(vt.isScalable, [IIT_SCALABLE_VEC.Number], []),
     !foreach(iit, IIT_Vecs, iit.Number),
@@ -518,7 +522,6 @@ def llvm_v128i1_ty     : LLVMType<v128i1>;   // 128 x i1
 def llvm_v256i1_ty     : LLVMType<v256i1>;   // 256 x i1
 def llvm_v512i1_ty     : LLVMType<v512i1>;   // 512 x i1
 def llvm_v1024i1_ty    : LLVMType<v1024i1>;  //1024 x i1
-def llvm_v2048i1_ty    : LLVMType<v2048i1>;  //2048 x i1
 
 def llvm_v1i8_ty       : LLVMType<v1i8>;     //  1 x i8
 def llvm_v2i8_ty       : LLVMType<v2i8>;     //  2 x i8


        


More information about the llvm-commits mailing list