[Mlir-commits] [mlir] [flang] [openmp] [Flang][OpenMP] Initial mapping of Fortran pointers and allocatables for target devices (PR #71766)
Kiran Chandramohan
llvmlistbot at llvm.org
Fri Nov 10 02:41:22 PST 2023
================
@@ -1718,11 +1737,38 @@ llvm::Value *getSizeInBytes(DataLayout &dl, const mlir::Type &type,
return builder.CreateMul(elementCount,
builder.getInt64(underlyingTypeSzInBits / 8));
}
+
+ // The case for allocatables that are not arrays, could perhaps treat these
+ // as just pointer size
+ if (memberClause.getBounds().empty() &&
+ memberClause.getIsFortranAllocatable()) {
+ return builder.CreateLoad(
+ builder.getInt64Ty(),
+ builder.CreateGEP(baseType, basePointer,
+ std::vector<llvm::Value *>{builder.getInt64(0),
+ builder.getInt32(1)},
+ "element_size"));
+ }
}
return builder.getInt64(underlyingTypeSzInBits / 8);
}
+// Get the underlying LLVM type, this will bypass the pointer and
+// access the underlying type. Which bypasses llvm's opaque pointers
+// to get the underlying type via MLIR.
+llvm::Type *getLLVMIRType(mlir::Type inputType,
+ LLVM::ModuleTranslation &moduleTranslation) {
+ llvm::Type *type = moduleTranslation.convertType(inputType);
+ if (auto pointerType =
+ llvm::dyn_cast<mlir::omp::PointerLikeType>(inputType)) {
+ if (auto eleType = pointerType.getElementType()) {
----------------
kiranchandramohan wrote:
This is not expected to work at the LLVM level due to opaque pointer changes.
https://github.com/llvm/llvm-project/pull/71766
More information about the Mlir-commits
mailing list