Skip to content

Commit af042aa

Browse files
Update based on review comments
1 parent 04a74e3 commit af042aa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

flang/lib/Optimizer/OpenMP/MapsForPrivatizedSymbols.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class MapsForPrivatizedSymbolsPass
103103
/*varPtrPtr=*/Value{},
104104
/*members=*/SmallVector<Value>{},
105105
/*member_index=*/mlir::ArrayAttr{},
106-
/*bounds=*/boundsOps.empty() ? SmallVector<Value>{} : boundsOps,
106+
/*bounds=*/boundsOps,
107107
/*mapperId=*/mlir::FlatSymbolRefAttr(), /*name=*/StringAttr(),
108108
builder.getBoolAttr(false));
109109
}
@@ -183,6 +183,7 @@ class MapsForPrivatizedSymbolsPass
183183
return fir::hasDynamicSize(innerType);
184184
return fir::hasDynamicSize(t);
185185
}
186+
186187
void genBoundsOps(fir::FirOpBuilder &builder, mlir::Value var,
187188
llvm::SmallVector<mlir::Value> &boundsOps) {
188189
if (!fir::isBoxAddress(var.getType()))
@@ -193,21 +194,20 @@ class MapsForPrivatizedSymbolsPass
193194
mlir::Location loc = var.getLoc();
194195
mlir::Type idxTy = builder.getIndexType();
195196
mlir::Value one = builder.createIntegerConstant(loc, idxTy, 1);
197+
mlir::Value zero = builder.createIntegerConstant(loc, idxTy, 0);
196198
mlir::Type boundTy = builder.getType<omp::MapBoundsType>();
197199
mlir::Value box = builder.create<fir::LoadOp>(loc, var);
198200
for (unsigned int i = 0; i < rank; ++i) {
199201
mlir::Value dimNo = builder.createIntegerConstant(loc, idxTy, i);
200202
auto dimInfo =
201203
builder.create<fir::BoxDimsOp>(loc, idxTy, idxTy, idxTy, box, dimNo);
202-
auto normalizedLB = builder.create<mlir::arith::ConstantOp>(
203-
loc, idxTy, builder.getIntegerAttr(idxTy, 0));
204204
mlir::Value lb = dimInfo.getLowerBound();
205205
mlir::Value extent = dimInfo.getExtent();
206206
mlir::Value byteStride = dimInfo.getByteStride();
207207
mlir::Value ub = builder.create<mlir::arith::SubIOp>(loc, extent, one);
208208

209209
mlir::Value boundsOp = builder.create<omp::MapBoundsOp>(
210-
loc, boundTy, /*lower_bound=*/normalizedLB,
210+
loc, boundTy, /*lower_bound=*/zero,
211211
/*upper_bound=*/ub, /*extent=*/extent, /*stride=*/byteStride,
212212
/*stride_in_bytes = */ true, /*start_idx=*/lb);
213213
LLVM_DEBUG(PDBGS() << "Created BoundsOp " << boundsOp << "\n");

0 commit comments

Comments
 (0)