@@ -1031,7 +1031,7 @@ static LogicalResult
1031
1031
convertOmpParallel (omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1032
1032
LLVM::ModuleTranslation &moduleTranslation) {
1033
1033
using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
1034
- omp::ParallelOp opInstClone = prepareOmpParallelForPrivatization (opInst);
1034
+ // omp::ParallelOp opInstClone = prepareOmpParallelForPrivatization(opInst);
1035
1035
1036
1036
// TODO: support error propagation in OpenMPIRBuilder and use it instead of
1037
1037
// relying on captured variables.
@@ -1041,12 +1041,12 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1041
1041
auto bodyGenCB = [&](InsertPointTy allocaIP, InsertPointTy codeGenIP) {
1042
1042
// Collect reduction declarations
1043
1043
SmallVector<omp::ReductionDeclareOp> reductionDecls;
1044
- collectReductionDecls (opInstClone , reductionDecls);
1044
+ collectReductionDecls (opInst , reductionDecls);
1045
1045
1046
1046
// Allocate reduction vars
1047
1047
SmallVector<llvm::Value *> privateReductionVariables;
1048
1048
DenseMap<Value, llvm::Value *> reductionVariableMap;
1049
- allocReductionVars (opInstClone , builder, moduleTranslation, allocaIP,
1049
+ allocReductionVars (opInst , builder, moduleTranslation, allocaIP,
1050
1050
reductionDecls, privateReductionVariables,
1051
1051
reductionVariableMap);
1052
1052
@@ -1058,7 +1058,7 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1058
1058
1059
1059
// Initialize reduction vars
1060
1060
builder.restoreIP (allocaIP);
1061
- for (unsigned i = 0 ; i < opInstClone .getNumReductionVars (); ++i) {
1061
+ for (unsigned i = 0 ; i < opInst .getNumReductionVars (); ++i) {
1062
1062
SmallVector<llvm::Value *> phis;
1063
1063
if (failed (inlineConvertOmpRegions (
1064
1064
reductionDecls[i].getInitializerRegion (), " omp.reduction.neutral" ,
@@ -1079,16 +1079,16 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1079
1079
// ParallelOp has only one region associated with it.
1080
1080
builder.restoreIP (codeGenIP);
1081
1081
auto regionBlock =
1082
- convertOmpOpRegions (opInstClone .getRegion (), " omp.par.region" , builder,
1082
+ convertOmpOpRegions (opInst .getRegion (), " omp.par.region" , builder,
1083
1083
moduleTranslation, bodyGenStatus);
1084
1084
1085
1085
// Process the reductions if required.
1086
- if (opInstClone .getNumReductionVars () > 0 ) {
1086
+ if (opInst .getNumReductionVars () > 0 ) {
1087
1087
// Collect reduction info
1088
1088
SmallVector<OwningReductionGen> owningReductionGens;
1089
1089
SmallVector<OwningAtomicReductionGen> owningAtomicReductionGens;
1090
1090
SmallVector<llvm::OpenMPIRBuilder::ReductionInfo> reductionInfos;
1091
- collectReductionInfo (opInstClone , builder, moduleTranslation,
1091
+ collectReductionInfo (opInst , builder, moduleTranslation,
1092
1092
reductionDecls, owningReductionGens,
1093
1093
owningAtomicReductionGens, privateReductionVariables,
1094
1094
reductionInfos);
@@ -1104,7 +1104,7 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1104
1104
ompBuilder->createReductions (builder.saveIP (), allocaIP,
1105
1105
reductionInfos, false );
1106
1106
if (!contInsertPoint.getBlock ()) {
1107
- bodyGenStatus = opInstClone ->emitOpError ()
1107
+ bodyGenStatus = opInst ->emitOpError ()
1108
1108
<< " failed to convert reductions" ;
1109
1109
return ;
1110
1110
}
@@ -1128,9 +1128,9 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1128
1128
// returned.
1129
1129
auto [privVar, privatizerClone] =
1130
1130
[&]() -> 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 ();
1134
1134
1135
1135
for (auto [privVar, privatizerAttr] :
1136
1136
llvm::zip_equal (privVars, *privatizers)) {
@@ -1143,7 +1143,7 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1143
1143
SymbolRefAttr privSym = llvm::cast<SymbolRefAttr>(privatizerAttr);
1144
1144
omp::PrivateClauseOp privatizer =
1145
1145
SymbolTable::lookupNearestSymbolFrom<omp::PrivateClauseOp>(
1146
- opInstClone , privSym);
1146
+ opInst , privSym);
1147
1147
1148
1148
// Clone the privatizer in case it used by more than one parallel
1149
1149
// region. The privatizer is processed in-place (see below) before it
@@ -1194,7 +1194,7 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1194
1194
SmallVector<llvm::Value *, 1 > yieldedValues;
1195
1195
if (failed (inlineConvertOmpRegions (allocRegion, " omp.privatizer" , builder,
1196
1196
moduleTranslation, &yieldedValues))) {
1197
- opInstClone .emitError (
1197
+ opInst .emitError (
1198
1198
" failed to inline `alloc` region of an `omp.private` "
1199
1199
" op in the parallel region" );
1200
1200
bodyGenStatus = failure ();
@@ -1216,13 +1216,13 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1216
1216
auto finiCB = [&](InsertPointTy codeGenIP) {};
1217
1217
1218
1218
llvm::Value *ifCond = nullptr ;
1219
- if (auto ifExprVar = opInstClone .getIfExprVar ())
1219
+ if (auto ifExprVar = opInst .getIfExprVar ())
1220
1220
ifCond = moduleTranslation.lookupValue (ifExprVar);
1221
1221
llvm::Value *numThreads = nullptr ;
1222
- if (auto numThreadsVar = opInstClone .getNumThreadsVar ())
1222
+ if (auto numThreadsVar = opInst .getNumThreadsVar ())
1223
1223
numThreads = moduleTranslation.lookupValue (numThreadsVar);
1224
1224
auto pbKind = llvm::omp::OMP_PROC_BIND_default;
1225
- if (auto bind = opInstClone .getProcBindVal ())
1225
+ if (auto bind = opInst .getProcBindVal ())
1226
1226
pbKind = getProcBindKind (*bind);
1227
1227
// TODO: Is the Parallel construct cancellable?
1228
1228
bool isCancellable = false ;
@@ -1235,7 +1235,7 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1235
1235
ompBuilder->createParallel (ompLoc, allocaIP, bodyGenCB, privCB, finiCB,
1236
1236
ifCond, numThreads, pbKind, isCancellable));
1237
1237
1238
- opInstClone .erase ();
1238
+ opInst .erase ();
1239
1239
return bodyGenStatus;
1240
1240
}
1241
1241
0 commit comments