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

Valentin Clement バレンタイン クレメン llvmlistbot at llvm.org
Fri May 24 08:14:42 PDT 2024


================
@@ -632,8 +632,12 @@ 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);
-      return llvm::ConstantArray::get(arrayType, constants);
+      if (child->isZeroValue()) {
+        return llvm::ConstantAggregateZero::get(arrayType);
+      } else {
+        std::vector<llvm::Constant *> constants(numElements, child);
----------------
clementval wrote:

Size seems to be limited to `4294967295 `

```
SmallVector unable to grow. Requested capacity (4294967296) is larger than maximum value for size type (4294967295)
```

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


More information about the Mlir-commits mailing list