[flang-commits] [PATCH] D151247: [flang][hlfir] Generate temporary storage in Forall/Where [1/2]

Tom Eccles via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu May 25 02:31:40 PDT 2023


tblah accepted this revision.
tblah added a comment.

Thanks for this. Looks good.



================
Comment at: flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp:149
   static bool hasVectorSubscriptedLhs(hlfir::RegionAssignOp regionAssignOp);
   /// Are they any leaf region in node that must be saved in the current run?
+  bool mustSaveRegionIn(
----------------



================
Comment at: flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp:219
+  /// Can the current loop nest iteration number be computed? For simplicity,
+  /// this is true if an only if all the bounds and steps of the fir.do_loop
+  /// nest dominates the outer loop. The argument is filled with the current
----------------



================
Comment at: flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp:253
+  llvm::DenseMap<mlir::Region *, fir::factory::TemporaryStorage> savedEntities;
+  /// Map holding the value that were saved in the current run and that also
+  /// need to be used (because their construct will be visited). It is reset
----------------



================
Comment at: flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp:256
+  /// after each run. It avoids having to store and fetch in the temporary
+  /// during the same run, which would required the temporary to have different
+  /// fetching and storing counters.
----------------



================
Comment at: flang/test/HLFIR/order_assignments/impure-where.fir:37
+// CHECK:           %[[VAL_12:.*]] = fir.call @impure() : () -> !fir.heap<!fir.array<10x!fir.logical<4>>>
+// CHECK:           %[[VAL_21:.*]] = fir.allocmem !fir.array<?x!fir.logical<4>>
+// CHECK:           %[[VAL_23:.*]]:2 = hlfir.declare %[[VAL_21]](%{{.*}}) {uniq_name = ".tmp.forall"}
----------------
Why doesn't this need a size parameter to tell the allocation how many elements are needed?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151247/new/

https://reviews.llvm.org/D151247



More information about the flang-commits mailing list