Skip to content

Commit eb6222f

Browse files
committed
conflict fixes
1 parent 8972fcd commit eb6222f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

flang/lib/Support/OpenMP-utils.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,14 @@ mlir::omp::MapInfoOp createMapInfoOp(mlir::OpBuilder &builder,
8989
mlir::Value mapTemporaryValue(fir::FirOpBuilder &firOpBuilder,
9090
mlir::omp::TargetOp targetOp, mlir::Value val, llvm::StringRef name) {
9191
mlir::OpBuilder::InsertionGuard guard(firOpBuilder);
92+
mlir::Operation *valOp = val.getDefiningOp();
93+
94+
if (valOp)
95+
firOpBuilder.setInsertionPointAfter(valOp);
96+
else
97+
// This means val is a block argument
98+
firOpBuilder.setInsertionPoint(targetOp);
9299

93-
firOpBuilder.setInsertionPointAfterValue(val);
94100
auto copyVal = firOpBuilder.createTemporary(val.getLoc(), val.getType());
95101
firOpBuilder.createStoreWithConvert(copyVal.getLoc(), val, copyVal);
96102

@@ -160,14 +166,13 @@ void cloneOrMapRegionOutsiders(fir::FirOpBuilder &firOpBuilder,
160166
while (!valuesDefinedAbove.empty()) {
161167
for (mlir::Value val : valuesDefinedAbove) {
162168
mlir::Operation *valOp = val.getDefiningOp();
163-
assert(valOp != nullptr);
164169

165170
// NOTE: We skip BoxDimsOp's as the lesser of two evils is to map the
166171
// indices separately, as the alternative is to eventually map the Box,
167172
// which comes with a fairly large overhead comparatively. We could be
168173
// more robust about this and check using a BackwardsSlice to see if we
169174
// run the risk of mapping a box.
170-
if (mlir::isMemoryEffectFree(valOp) &&
175+
if (valOp && mlir::isMemoryEffectFree(valOp) &&
171176
!mlir::isa<fir::BoxDimsOp>(valOp)) {
172177
mlir::Operation *clonedOp = valOp->clone();
173178
entryBlock->push_front(clonedOp);

0 commit comments

Comments
 (0)