[clang] [CIR] Upstream global initialization for VectorType (PR #137511)
Amr Hesham via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 28 10:10:56 PDT 2025
================
@@ -373,8 +373,27 @@ mlir::Attribute ConstantEmitter::tryEmitPrivate(const APValue &value,
elements, typedFiller);
}
case APValue::Vector: {
- cgm.errorNYI("ConstExprEmitter::tryEmitPrivate vector");
- return {};
+ const QualType elementType =
+ destType->castAs<VectorType>()->getElementType();
+ const unsigned numElements = value.getVectorLength();
+
+ SmallVector<mlir::Attribute, 16> elements;
+ elements.reserve(numElements);
+
+ for (unsigned i = 0; i < numElements; ++i) {
+ const mlir::Attribute element =
+ tryEmitPrivateForMemory(value.getVectorElt(i), elementType);
+ if (!element)
+ return {};
----------------
AmrDeveloper wrote:
As far as I understood, yes the destructor will be called when we early return and will clean the vector
https://github.com/llvm/llvm-project/pull/137511
More information about the cfe-commits
mailing list