Skip to content

Commit 3581944

Browse files
committed
Revert HLFIR op change
1 parent e748dc5 commit 3581944

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

flang/include/flang/Optimizer/HLFIR/HLFIROps.td

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,26 +1419,28 @@ def hlfir_YieldOp : hlfir_Op<"yield", [Terminator, ParentOneOf<["RegionAssignOp"
14191419
let assemblyFormat = "$entity attr-dict `:` type($entity) custom<YieldOpCleanup>($cleanup)";
14201420
}
14211421

1422-
def hlfir_ElementalAddrOp : hlfir_Op<"elemental_addr", [Terminator,
1422+
def hlfir_ElementalAddrOp : hlfir_Op<"elemental_addr", [Terminator, HasParent<"RegionAssignOp">,
14231423
RecursiveMemoryEffects, RecursivelySpeculatable, hlfir_ElementalOpInterface,
14241424
AttrSizedOperandSegments]> {
14251425
let summary = "Yield the address of a vector subscripted variable inside an hlfir.region_assign";
14261426
let description = [{
1427-
Used to get the address of elements in an array which is being subscripted
1428-
by a vector.
1427+
Special terminator node for the left-hand side region of an hlfir.region_assign
1428+
to a vector subscripted entity.
14291429

14301430
It represents how the address of an element of such entity is computed given
14311431
one based indices.
14321432

14331433
It is very similar to hlfir.elemental, except that it does not produce an SSA
14341434
value because there is no hlfir type to describe a vector subscripted entity
1435-
(the codegen of such type would be problematic).
1435+
(the codegen of such type would be problematic). Hence, it is tightly linked
1436+
to an hlfir.region_assign by its terminator property.
14361437

14371438
An optional cleanup region may be provided if any of the subscript expressions
14381439
of the designator require a cleanup.
14391440
This allows documenting cleanups that cannot be generated after the vector
14401441
subscripted designator usage (that has not been materizaled yet). The cleanups
1441-
should be evaluated after the usage of the elemental addr.
1442+
will be evaluated after the assignment once the related
1443+
hlfir.region_assign is lowered.
14421444

14431445
Example: "X(VECTOR) = Y"
14441446

flang/lib/Lower/OpenMP/ClauseProcessor.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,13 @@ bool ClauseProcessor::processDepend(lower::SymMap &symMap,
898898

899899
// Get a hlfir.elemental_addr op describing the address of the value
900900
// 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.
901908
hlfir::ElementalAddrOp addrOp =
902909
convertVectorSubscriptedExprToElementalAddr(
903910
converter.getCurrentLocation(), converter, expr, symMap,

0 commit comments

Comments
 (0)