https://github.com/AmrDeveloper created 
https://github.com/llvm/llvm-project/pull/140125

Upstream vector support in the element type if vector as a required change for 
upstreaming other Vec Ops

Issue https://github.com/llvm/llvm-project/issues/136487

>From b9f624e508db8349516f909f0c8e9cb85c04e0d1 Mon Sep 17 00:00:00 2001
From: AmrDeveloper <am...@programmer.net>
Date: Thu, 15 May 2025 21:17:56 +0200
Subject: [PATCH] [CIR] Upstream Vector support in elementTypeIfVector

---
 clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp 
b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 3c85bb4b6b41d..c3f8ad2521d1d 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -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))
+    return vecType.getElementType();
   return type;
 }
 } // namespace

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to