[llvm] [IR] Avoid visited set for simple isScalableTy queries (NFC) (PR #221743)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 07:49:56 PDT 2026


================
@@ -67,6 +67,18 @@ bool Type::isScalableTy(SmallPtrSetImpl<const Type *> &Visited) const {
 }
 
 bool Type::isScalableTy() const {
+  switch (getTypeID()) {
+  case ScalableVectorTyID:
+    return true;
+  case TargetExtTyID:
+    return isScalableTargetExtTy();
+  case ArrayTyID:
+  case StructTyID:
+    break;
----------------
MacDue wrote:

nit: It's maybe a little clearer if you move the `isScalableTy()` call into the switch. 
```suggestion
    {
      SmallPtrSet<const Type *, 4> Visited;
      return isScalableTy(Visited);
    }
```

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


More information about the llvm-commits mailing list