[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
Fri May 24 08:30:24 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:
`ConstantArray` creation for scalar types will have to build a vector of the individual integers by extracting from the Constant object. So you're necessarily incurring more work in this case, see the code here for example: https://github.com/llvm/llvm-project/blob/53b904823cba4e93d58793b0804407f812477724/llvm/lib/IR/Constants.cpp#L1220-L1226
Now something a bit strange is that this is using a SmallVector as well, so it should fail the exact same way shouldn't it?
https://github.com/llvm/llvm-project/pull/93230
More information about the flang-commits
mailing list