Skip to content

Commit a47ea24

Browse files
committed
Emit loop nests in a custom wrapper
1 parent cca8588 commit a47ea24

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

flang/include/flang/Optimizer/Builder/HLFIRTools.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,12 @@ struct LoopNest {
367367
/// are unordered.
368368
LoopNest genLoopNest(mlir::Location loc, fir::FirOpBuilder &builder,
369369
mlir::ValueRange extents, bool isUnordered = false,
370-
bool emitWsLoop = false);
370+
bool emitWorkshareLoop = false);
371371
inline LoopNest genLoopNest(mlir::Location loc, fir::FirOpBuilder &builder,
372372
mlir::Value shape, bool isUnordered = false,
373-
bool emitWsLoop = false) {
373+
bool emitWorkshareLoop = false) {
374374
return genLoopNest(loc, builder, getIndexExtents(loc, builder, shape),
375-
isUnordered, emitWsLoop);
375+
isUnordered, emitWorkshareLoop);
376376
}
377377

378378
/// Inline the body of an hlfir.elemental at the current insertion point

flang/lib/Optimizer/Builder/HLFIRTools.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -857,19 +857,18 @@ mlir::Value hlfir::inlineElementalOp(
857857
hlfir::LoopNest hlfir::genLoopNest(mlir::Location loc,
858858
fir::FirOpBuilder &builder,
859859
mlir::ValueRange extents, bool isUnordered,
860-
bool emitWsLoop) {
860+
bool emitWorkshareLoop) {
861861
hlfir::LoopNest loopNest;
862862
assert(!extents.empty() && "must have at least one extent");
863863
mlir::OpBuilder::InsertionGuard guard(builder);
864864
loopNest.oneBasedIndices.assign(extents.size(), mlir::Value{});
865865
// Build loop nest from column to row.
866866
auto one = builder.create<mlir::arith::ConstantIndexOp>(loc, 1);
867867
mlir::Type indexType = builder.getIndexType();
868-
if (emitWsLoop) {
869-
auto wsloop = builder.create<mlir::omp::WsloopOp>(
870-
loc, mlir::ArrayRef<mlir::NamedAttribute>());
871-
loopNest.outerOp = wsloop;
872-
builder.createBlock(&wsloop.getRegion());
868+
if (emitWorkshareLoop) {
869+
auto wslw = builder.create<mlir::omp::WorkshareLoopWrapperOp>(loc);
870+
loopNest.outerOp = wslw;
871+
builder.createBlock(&wslw.getRegion());
873872
mlir::omp::LoopNestOperands lnops;
874873
lnops.loopInclusive = builder.getUnitAttr();
875874
for (auto extent : llvm::reverse(extents)) {

0 commit comments

Comments
 (0)