[clang] [CIR] Upstream Vector support in elementTypeIfVector (PR #140125)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Thu May 15 12:42:16 PDT 2025
================
@@ -54,10 +54,12 @@ namespace direct {
namespace {
/// If the given type is a vector type, return the vector's element type.
/// Otherwise return the given type unchanged.
-// TODO(cir): Return the vector element type once we have support for vectors
-// instead of the identity type.
mlir::Type elementTypeIfVector(mlir::Type type) {
- assert(!cir::MissingFeatures::vectorType());
+ if (auto vecType = mlir::dyn_cast<cir::VectorType>(type))
+ return vecType.getElementType();
+
+ if (auto vecType = mlir::dyn_cast<mlir::VectorType>(type))
----------------
andykaylor wrote:
I've looked at this twice now, and both times I thought these two `if` statements were identical. It took a third look to see that one is checking for `cir::VectorType` and the other is checking for `mlir::VectorType`. Maybe add a comment drawing attention to this fact?
https://github.com/llvm/llvm-project/pull/140125
More information about the cfe-commits
mailing list