Skip to content

Commit

Permalink
[LLVM][TableGen] Check validity of IIT encoding for vector types (#11…
Browse files Browse the repository at this point in the history
…1152)

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.
  • Loading branch information
jurahul authored Oct 4, 2024
1 parent b91f0de commit ed0f407
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion llvm/include/llvm/IR/Intrinsics.td
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ed0f407

Please sign in to comment.