[llvm] [SandboxVec][BottomUpVec] Generate vector instructions (PR #115087)

Jorge Gorbe Moya via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 15:48:57 PST 2024


================
@@ -66,6 +66,40 @@ class VecUtils {
     }
     return true;
   }
+
+  /// \Returns the number of vector lanes of \p Ty or 1 if not a vector.
+  /// NOTE: It asserts that \p Ty is a fixed vector type.
+  static unsigned getNumLanes(Type *Ty) {
+    assert(!isa<ScalableVectorType>(Ty) && "Expect fixed vector");
+    if (!isa<FixedVectorType>(Ty))
+      return 1;
+    return cast<FixedVectorType>(Ty)->getNumElements();
----------------
slackito wrote:

This isa + cast could be a dyn_cast.

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


More information about the llvm-commits mailing list