@@ -895,50 +895,8 @@ bool ClauseProcessor::processDepend(lower::SymMap &symMap,
895895 // the standard to be the lowest index) to identify the dependency. We
896896 // don't need an accurate length for the array section because the
897897 // OpenMP standard forbids overlapping array sections.
898-
899- // Get a hlfir.elemental_addr op describing the address of the value
900- // indexed from the original array.
901- // Note: the hlfir.elemental_addr op verifier requires it to be inside
902- // of a hlfir.region_assign op. This is because the only place in base
903- // Fortran where you need the address of a vector subscript would be
904- // in an assignment operation. We are not doing an assignment here
905- // but we do want the address (without having to duplicate all of
906- // Fortran designation lowering!). This operation is never seen by the
907- // verifier because it is immediately inlined.
908- hlfir::ElementalAddrOp addrOp =
909- convertVectorSubscriptedExprToElementalAddr (
910- converter.getCurrentLocation (), converter, expr, symMap,
911- stmtCtx);
912- if (!addrOp.getCleanup ().empty ())
913- TODO (converter.getCurrentLocation (),
914- " Vector subscript in DEPEND clause requring a cleanup region" );
915-
916- // hlfir.elemental_addr doesn't have a normal lowering because it
917- // can't return a value. Instead we need to inline it here using
918- // values for the first element. Similar to hlfir::inlineElementalOp.
919-
920- mlir::Value one = builder.createIntegerConstant (
921- converter.getCurrentLocation (), builder.getIndexType (), 1 );
922- mlir::SmallVector<mlir::Value> oneBasedIndices;
923- oneBasedIndices.resize (addrOp.getIndices ().size (), one);
924-
925- mlir::IRMapping mapper;
926- mapper.map (addrOp.getIndices (), oneBasedIndices);
927- assert (addrOp.getElementalRegion ().hasOneBlock ());
928- mlir::Operation *newOp;
929- for (mlir::Operation &op :
930- addrOp.getElementalRegion ().back ().getOperations ())
931- newOp = builder.clone (op, mapper);
932- auto yield = mlir::cast<hlfir::YieldOp>(newOp);
933-
934- addrOp->erase ();
935-
936- if (!yield.getCleanup ().empty ())
937- TODO (converter.getCurrentLocation (),
938- " Vector subscript in DEPEND clause requring element cleanup" );
939-
940- dependVar = yield.getEntity ();
941- yield->erase ();
898+ dependVar = genVectorSubscriptedDesignatorFirstElementAddress (
899+ converter.getCurrentLocation (), converter, expr, symMap, stmtCtx);
942900 } else {
943901 // Ordinary array section e.g. A(1:512:2)
944902 hlfir::EntityWithAttributes entity = convertExprToHLFIR (
0 commit comments