@@ -126,59 +126,6 @@ createArrayTemp(mlir::Location loc, fir::FirOpBuilder &builder,
126126 loc, sequenceType, shape, extents, lenParams, genTempDeclareOp,
127127 polymorphicMold ? polymorphicMold->getFirBase () : nullptr );
128128 return {hlfir::Entity{base}, builder.createBool (loc, isHeapAlloc)};
129- #if 0
130- llvm::StringRef tmpName{".tmp.array"};
131-
132- if (polymorphicMold) {
133- // Create *allocated* polymorphic temporary using the dynamic type
134- // of the mold and the provided shape/extents. The created temporary
135- // array will be written element per element, that is why it has to be
136- // allocated.
137- mlir::Type boxHeapType = fir::HeapType::get(sequenceType);
138- mlir::Value alloc = fir::factory::genNullBoxStorage(
139- builder, loc, fir::ClassType::get(boxHeapType));
140- mlir::Value isHeapAlloc = builder.createBool(loc, true);
141- fir::FortranVariableFlagsAttr declAttrs =
142- fir::FortranVariableFlagsAttr::get(
143- builder.getContext(), fir::FortranVariableFlagsEnum::allocatable);
144-
145- auto declareOp =
146- builder.create<hlfir::DeclareOp>(loc, alloc, tmpName,
147- /*shape=*/nullptr, lenParams,
148- /*dummy_scope=*/nullptr, declAttrs);
149-
150- int rank = extents.size();
151- fir::runtime::genAllocatableApplyMold(builder, loc, alloc,
152- polymorphicMold->getFirBase(), rank);
153- if (!extents.empty()) {
154- mlir::Type idxTy = builder.getIndexType();
155- mlir::Value one = builder.createIntegerConstant(loc, idxTy, 1);
156- unsigned dim = 0;
157- for (mlir::Value extent : extents) {
158- mlir::Value dimIndex = builder.createIntegerConstant(loc, idxTy, dim++);
159- fir::runtime::genAllocatableSetBounds(builder, loc, alloc, dimIndex,
160- one, extent);
161- }
162- }
163- if (!lenParams.empty()) {
164- // We should call AllocatableSetDerivedLength() here.
165- // TODO: does the mold provide the length parameters or
166- // the operation itself or should they be in sync?
167- TODO(loc, "polymorphic type with length parameters in HLFIR");
168- }
169- fir::runtime::genAllocatableAllocate(builder, loc, alloc);
170-
171- return {hlfir::Entity{declareOp.getBase()}, isHeapAlloc};
172- }
173-
174- mlir::Value allocmem = builder.createHeapTemporary(loc, sequenceType, tmpName,
175- extents, lenParams);
176- auto declareOp = builder.create<hlfir::DeclareOp>(
177- loc, allocmem, tmpName, shape, lenParams,
178- /*dummy_scope=*/nullptr, fir::FortranVariableFlagsAttr{});
179- mlir::Value trueVal = builder.createBool(loc, true);
180- return {hlfir::Entity{declareOp.getBase()}, trueVal};
181- #endif
182129}
183130
184131// / Copy \p source into a new temporary and package the temporary into a
0 commit comments