[llvm] [LLVM][TableGen] Check validity of IIT encoding for vector types (PR #111152)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 08:19:45 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Rahul Joshi (jurahul)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/111152.diff
1 Files Affected:
- (modified) llvm/include/llvm/IR/Intrinsics.td (+4-1)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/111152
More information about the llvm-commits
mailing list