Skip to content

Commit 13c484c

Browse files
authored
[CIR] Upstream Vector support in elementTypeIfVector (#140125)
Upstream vector support in the element type if vector as a required change for upstreaming other Vec Ops Issue #136487
1 parent 7028c00 commit 13c484c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ namespace direct {
5454
namespace {
5555
/// If the given type is a vector type, return the vector's element type.
5656
/// Otherwise return the given type unchanged.
57-
// TODO(cir): Return the vector element type once we have support for vectors
58-
// instead of the identity type.
5957
mlir::Type elementTypeIfVector(mlir::Type type) {
60-
assert(!cir::MissingFeatures::vectorType());
61-
return type;
58+
return llvm::TypeSwitch<mlir::Type, mlir::Type>(type)
59+
.Case<cir::VectorType, mlir::VectorType>(
60+
[](auto p) { return p->getElementType(); })
61+
.Default([](mlir::Type p) { return p; });
6262
}
6363
} // namespace
6464

0 commit comments

Comments
 (0)