[flang-commits] [flang] [flang] In AllocMemOp lowering, convert types for calling malloc on 32-bit (PR #129308)
via flang-commits
flang-commits at lists.llvm.org
Fri Feb 28 15:34:53 PST 2025
================
@@ -992,7 +992,7 @@ getMallocInModule(ModuleOp mod, fir::AllocMemOp op,
return mlir::SymbolRefAttr::get(userMalloc);
mlir::OpBuilder moduleBuilder(mod.getBodyRegion());
- auto indexType = mlir::IntegerType::get(op.getContext(), 64);
+ auto indexType = mlir::IntegerType::get(op.getContext(), addr32 ? 32 : 64);
----------------
ArcaneNibble wrote:
I just refactored it to use that function. However, this function doesn't return `32` as required, because the default size in `mlir/lib/Interfaces/DataLayoutInterfaces.cpp` is also hardcoded as 64.
I was considering fixing `DataLayoutImporter::translateDataLayout` so that it uses "the size of pointers in the default address space" as the bit width of the index type, but I didn't do that for now because I am not sure if this is correct for all targets and users of MLIR. Could you or someone else chime in?
https://github.com/llvm/llvm-project/pull/129308
More information about the flang-commits
mailing list