[llvm] [llubi] Reject invalid types (PR #230495)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 11 09:30:30 PDT 2026


================
@@ -1270,6 +1270,83 @@ uint64_t Context::getEffectiveTypeStoreSize(Type *Ty) {
   return getEffectiveTypeSize(DL.getTypeStoreSize(Ty));
 }
 
+bool Context::isValid(raw_ostream &OS) const {
+  assert(isPowerOf2_32(VScale) && "VScale must be a power of two.");
+  uint32_t MaxNumElements = UINT32_MAX / VScale;
+
+  SmallPtrSet<Type *, 16> ValidAggTys;
+  auto IsSupportedType = [&](auto &&Self, Type *Ty) {
+    switch (Ty->getTypeID()) {
+    case Type::X86_AMXTyID:
+    case Type::TargetExtTyID:
+      OS << "Unsupported type " << *Ty << '\n';
+      return false;
+    case Type::ScalableVectorTyID:
+      // Avoid overflow when computing EVL.
+      if (cast<VectorType>(Ty)->getElementCount().getKnownMinValue() >=
----------------
dtcxzyw wrote:

Switched to size-based check.

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


More information about the llvm-commits mailing list