[llvm] [LLVM][TableGen] Check validity of IIT encoding for vector types (PR #111152)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 06:35:25 PDT 2024
https://github.com/jurahul created https://github.com/llvm/llvm-project/pull/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.
>From 47fb842ea7b938614f665bd2e89de40795bab4e4 Mon Sep 17 00:00:00 2001
From: Rahul Joshi <rjoshi at nvidia.com>
Date: Fri, 4 Oct 2024 06:30:19 -0700
Subject: [PATCH] [LLVM][TableGen] Check validity of IIT encoding for vector
types
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.
---
llvm/include/llvm/IR/Intrinsics.td | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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