[flang-commits] [PATCH] D151247: [flang][hlfir] Generate temporary storage in Forall/Where [1/2]
Slava Zakharin via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed May 24 12:38:59 PDT 2023
vzakhari accepted this revision.
vzakhari added a comment.
This revision is now accepted and ready to land.
Thank you, Jean! It looks great!
================
Comment at: flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp:202
+
+ /// Get a value if it was save in this run or a previous run. Returns
+ /// nullopt if it has not been saved.
----------------
================
Comment at: flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp:399
+ if (auto maybeSaved = getIfSaved(whereOp.getMaskRegion())) {
+ // Used the saved value to get the shape and condition element.
+ hlfir::Entity savedMask{maybeSaved->first};
----------------
================
Comment at: flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp:418
+ }
+ // The mask was not evaluated yet or can be safely be re-evaluated.
+ MaskedArrayExpr mask(loc, whereOp.getMaskRegion());
----------------
================
Comment at: flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp:630
for (auto &op : maybeYield->getCleanup().back().getOperations())
- builder.clone(op, mapper);
+ if (!mlir::isa<fir::FirEndOp>(op))
+ builder.clone(op, mapper);
----------------
Thanks!
================
Comment at: flang/test/HLFIR/order_assignments/impure-where.fir:2
+// Test code generation of hlfir.where/hflir.elsewhere when an
+// "impure" mask is used an several runs are needed. The mask
+// must be saved so that the impure function is only evaluated once.
----------------
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