|
20 | 20 | #include "flang/Optimizer/HLFIR/HLFIRDialect.h"
|
21 | 21 | #include "flang/Optimizer/HLFIR/HLFIROps.h"
|
22 | 22 | #include "flang/Optimizer/HLFIR/Passes.h"
|
| 23 | +#include "flang/Optimizer/OpenMP/Passes.h" |
23 | 24 | #include "flang/Optimizer/Transforms/Utils.h"
|
24 | 25 | #include "mlir/Dialect/Func/IR/FuncOps.h"
|
25 | 26 | #include "mlir/IR/Dominance.h"
|
@@ -482,7 +483,8 @@ llvm::LogicalResult ElementalAssignBufferization::matchAndRewrite(
|
482 | 483 | // Generate a loop nest looping around the hlfir.elemental shape and clone
|
483 | 484 | // hlfir.elemental region inside the inner loop
|
484 | 485 | hlfir::LoopNest loopNest =
|
485 |
| - hlfir::genLoopNest(loc, builder, extents, !elemental.isOrdered()); |
| 486 | + hlfir::genLoopNest(loc, builder, extents, !elemental.isOrdered(), |
| 487 | + flangomp::shouldUseWorkshareLowering(elemental)); |
486 | 488 | builder.setInsertionPointToStart(loopNest.body);
|
487 | 489 | auto yield = hlfir::inlineElementalOp(loc, builder, elemental,
|
488 | 490 | loopNest.oneBasedIndices);
|
@@ -553,7 +555,8 @@ llvm::LogicalResult BroadcastAssignBufferization::matchAndRewrite(
|
553 | 555 | llvm::SmallVector<mlir::Value> extents =
|
554 | 556 | hlfir::getIndexExtents(loc, builder, shape);
|
555 | 557 | hlfir::LoopNest loopNest =
|
556 |
| - hlfir::genLoopNest(loc, builder, extents, /*isUnordered=*/true); |
| 558 | + hlfir::genLoopNest(loc, builder, extents, /*isUnordered=*/true, |
| 559 | + flangomp::shouldUseWorkshareLowering(assign)); |
557 | 560 | builder.setInsertionPointToStart(loopNest.body);
|
558 | 561 | auto arrayElement =
|
559 | 562 | hlfir::getElementAt(loc, builder, lhs, loopNest.oneBasedIndices);
|
@@ -648,7 +651,8 @@ llvm::LogicalResult VariableAssignBufferization::matchAndRewrite(
|
648 | 651 | llvm::SmallVector<mlir::Value> extents =
|
649 | 652 | hlfir::getIndexExtents(loc, builder, shape);
|
650 | 653 | hlfir::LoopNest loopNest =
|
651 |
| - hlfir::genLoopNest(loc, builder, extents, /*isUnordered=*/true); |
| 654 | + hlfir::genLoopNest(loc, builder, extents, /*isUnordered=*/true, |
| 655 | + flangomp::shouldUseWorkshareLowering(elemental)); |
652 | 656 | builder.setInsertionPointToStart(loopNest.body);
|
653 | 657 | auto rhsArrayElement =
|
654 | 658 | hlfir::getElementAt(loc, builder, rhs, loopNest.oneBasedIndices);
|
|
0 commit comments