[flang-commits] [flang] [flang][hlfir] Lower Cray pointee references. (PR #65563)
via flang-commits
flang-commits at lists.llvm.org
Thu Sep 7 08:58:48 PDT 2023
================
@@ -1492,6 +1494,52 @@ static void genDeclareSymbol(Fortran::lower::AbstractConverter &converter,
auto name = converter.mangleName(sym);
fir::FortranVariableFlagsAttr attributes =
Fortran::lower::translateSymbolAttributes(builder.getContext(), sym);
+
+ if (isCrayPointee) {
+ mlir::Type baseType =
+ hlfir::getFortranElementOrSequenceType(base.getType());
+ if (auto seqType = mlir::dyn_cast<fir::SequenceType>(baseType)) {
+ // The pointer box's sequence type must be with unknown shape.
+ llvm::SmallVector<int64_t> shape(seqType.getDimension(),
+ fir::SequenceType::getUnknownExtent());
+ baseType = fir::SequenceType::get(shape, seqType.getEleTy());
+ }
+ fir::BoxType ptrBoxType =
+ fir::BoxType::get(fir::PointerType::get(baseType));
+ mlir::Value boxAlloc =
+ fir::factory::genNullBoxStorage(builder, loc, ptrBoxType);
----------------
jeanPerier wrote:
It is not necessary, this was a (very minor) personal opinion regarding the readability of the generated IR. I am also fine with the way it is.
https://github.com/llvm/llvm-project/pull/65563
More information about the flang-commits
mailing list