Skip to content

Commit 3933d26

Browse files
committed
[to-be-reverted] Do not re-map parallel op's arguments
1 parent 363ae7f commit 3933d26

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ static LogicalResult
10311031
convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
10321032
LLVM::ModuleTranslation &moduleTranslation) {
10331033
using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
1034-
omp::ParallelOp opInstClone = prepareOmpParallelForPrivatization(opInst);
1034+
//omp::ParallelOp opInstClone = prepareOmpParallelForPrivatization(opInst);
10351035

10361036
// TODO: support error propagation in OpenMPIRBuilder and use it instead of
10371037
// relying on captured variables.
@@ -1041,12 +1041,12 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
10411041
auto bodyGenCB = [&](InsertPointTy allocaIP, InsertPointTy codeGenIP) {
10421042
// Collect reduction declarations
10431043
SmallVector<omp::ReductionDeclareOp> reductionDecls;
1044-
collectReductionDecls(opInstClone, reductionDecls);
1044+
collectReductionDecls(opInst, reductionDecls);
10451045

10461046
// Allocate reduction vars
10471047
SmallVector<llvm::Value *> privateReductionVariables;
10481048
DenseMap<Value, llvm::Value *> reductionVariableMap;
1049-
allocReductionVars(opInstClone, builder, moduleTranslation, allocaIP,
1049+
allocReductionVars(opInst, builder, moduleTranslation, allocaIP,
10501050
reductionDecls, privateReductionVariables,
10511051
reductionVariableMap);
10521052

@@ -1058,7 +1058,7 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
10581058

10591059
// Initialize reduction vars
10601060
builder.restoreIP(allocaIP);
1061-
for (unsigned i = 0; i < opInstClone.getNumReductionVars(); ++i) {
1061+
for (unsigned i = 0; i < opInst.getNumReductionVars(); ++i) {
10621062
SmallVector<llvm::Value *> phis;
10631063
if (failed(inlineConvertOmpRegions(
10641064
reductionDecls[i].getInitializerRegion(), "omp.reduction.neutral",
@@ -1079,16 +1079,16 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
10791079
// ParallelOp has only one region associated with it.
10801080
builder.restoreIP(codeGenIP);
10811081
auto regionBlock =
1082-
convertOmpOpRegions(opInstClone.getRegion(), "omp.par.region", builder,
1082+
convertOmpOpRegions(opInst.getRegion(), "omp.par.region", builder,
10831083
moduleTranslation, bodyGenStatus);
10841084

10851085
// Process the reductions if required.
1086-
if (opInstClone.getNumReductionVars() > 0) {
1086+
if (opInst.getNumReductionVars() > 0) {
10871087
// Collect reduction info
10881088
SmallVector<OwningReductionGen> owningReductionGens;
10891089
SmallVector<OwningAtomicReductionGen> owningAtomicReductionGens;
10901090
SmallVector<llvm::OpenMPIRBuilder::ReductionInfo> reductionInfos;
1091-
collectReductionInfo(opInstClone, builder, moduleTranslation,
1091+
collectReductionInfo(opInst, builder, moduleTranslation,
10921092
reductionDecls, owningReductionGens,
10931093
owningAtomicReductionGens, privateReductionVariables,
10941094
reductionInfos);
@@ -1104,7 +1104,7 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
11041104
ompBuilder->createReductions(builder.saveIP(), allocaIP,
11051105
reductionInfos, false);
11061106
if (!contInsertPoint.getBlock()) {
1107-
bodyGenStatus = opInstClone->emitOpError()
1107+
bodyGenStatus = opInst->emitOpError()
11081108
<< "failed to convert reductions";
11091109
return;
11101110
}
@@ -1128,9 +1128,9 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
11281128
// returned.
11291129
auto [privVar, privatizerClone] =
11301130
[&]() -> std::pair<mlir::Value, omp::PrivateClauseOp> {
1131-
if (!opInstClone.getPrivateVars().empty()) {
1132-
auto privVars = opInstClone.getPrivateVars();
1133-
auto privatizers = opInstClone.getPrivatizers();
1131+
if (!opInst.getPrivateVars().empty()) {
1132+
auto privVars = opInst.getPrivateVars();
1133+
auto privatizers = opInst.getPrivatizers();
11341134

11351135
for (auto [privVar, privatizerAttr] :
11361136
llvm::zip_equal(privVars, *privatizers)) {
@@ -1143,7 +1143,7 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
11431143
SymbolRefAttr privSym = llvm::cast<SymbolRefAttr>(privatizerAttr);
11441144
omp::PrivateClauseOp privatizer =
11451145
SymbolTable::lookupNearestSymbolFrom<omp::PrivateClauseOp>(
1146-
opInstClone, privSym);
1146+
opInst, privSym);
11471147

11481148
// Clone the privatizer in case it used by more than one parallel
11491149
// region. The privatizer is processed in-place (see below) before it
@@ -1194,7 +1194,7 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
11941194
SmallVector<llvm::Value *, 1> yieldedValues;
11951195
if (failed(inlineConvertOmpRegions(allocRegion, "omp.privatizer", builder,
11961196
moduleTranslation, &yieldedValues))) {
1197-
opInstClone.emitError(
1197+
opInst.emitError(
11981198
"failed to inline `alloc` region of an `omp.private` "
11991199
"op in the parallel region");
12001200
bodyGenStatus = failure();
@@ -1216,13 +1216,13 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
12161216
auto finiCB = [&](InsertPointTy codeGenIP) {};
12171217

12181218
llvm::Value *ifCond = nullptr;
1219-
if (auto ifExprVar = opInstClone.getIfExprVar())
1219+
if (auto ifExprVar = opInst.getIfExprVar())
12201220
ifCond = moduleTranslation.lookupValue(ifExprVar);
12211221
llvm::Value *numThreads = nullptr;
1222-
if (auto numThreadsVar = opInstClone.getNumThreadsVar())
1222+
if (auto numThreadsVar = opInst.getNumThreadsVar())
12231223
numThreads = moduleTranslation.lookupValue(numThreadsVar);
12241224
auto pbKind = llvm::omp::OMP_PROC_BIND_default;
1225-
if (auto bind = opInstClone.getProcBindVal())
1225+
if (auto bind = opInst.getProcBindVal())
12261226
pbKind = getProcBindKind(*bind);
12271227
// TODO: Is the Parallel construct cancellable?
12281228
bool isCancellable = false;
@@ -1235,7 +1235,7 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
12351235
ompBuilder->createParallel(ompLoc, allocaIP, bodyGenCB, privCB, finiCB,
12361236
ifCond, numThreads, pbKind, isCancellable));
12371237

1238-
opInstClone.erase();
1238+
opInst.erase();
12391239
return bodyGenStatus;
12401240
}
12411241

0 commit comments

Comments
 (0)