[flang-commits] [flang] [mlir] [mlir] Align num elements type to LLVM ArrayType (PR #93230)

Mehdi Amini via flang-commits flang-commits at lists.llvm.org
Thu May 23 14:45:09 PDT 2024


================
@@ -632,7 +632,7 @@ llvm::Constant *mlir::LLVM::detail::getLLVMConstant(
           llvm::ElementCount::get(numElements, /*Scalable=*/isScalable), child);
     if (llvmType->isArrayTy()) {
       auto *arrayType = llvm::ArrayType::get(elementType, numElements);
-      SmallVector<llvm::Constant *, 8> constants(numElements, child);
+      std::vector<llvm::Constant *> constants(numElements, child);
       return llvm::ConstantArray::get(arrayType, constants);
----------------
joker-eph wrote:

We're in the splat case, we can have a fast path for zero by getting a `ConstantAggregateZero` instead here.

And if not, we can go the `ConstantDataArray` route instead when the element type is scalar.

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


More information about the flang-commits mailing list