@@ -1597,24 +1597,21 @@ convertOmpTaskOp(omp::TaskOp taskOp, llvm::IRBuilderBase &builder,
15971597 splitBB (builder, /* CreateBranch=*/ true , " omp.private.copy" );
15981598 builder.SetInsertPoint (copyBlock->getFirstNonPHIOrDbgOrAlloca ());
15991599 }
1600- for (unsigned i = 0 ; i < privateBlockArgs. size (); ++i) {
1601- if (privateDecls[i]. getDataSharingType () !=
1602- omp::DataSharingClauseType::FirstPrivate)
1600+ for (auto [decl, mlirVar, llvmVar] :
1601+ llvm::zip_equal (privateDecls, mlirPrivateVars, llvmPrivateVars)) {
1602+ if (decl. getDataSharingType () != omp::DataSharingClauseType::FirstPrivate)
16031603 continue ;
16041604
16051605 // copyRegion implements `lhs = rhs`
1606- Region ©Region = privateDecls[i] .getCopyRegion ();
1606+ Region ©Region = decl .getCopyRegion ();
16071607
16081608 // map copyRegion rhs arg
1609- llvm::Value *nonPrivateVar =
1610- moduleTranslation.lookupValue (taskOp.getPrivateVars ()[i]);
1609+ llvm::Value *nonPrivateVar = moduleTranslation.lookupValue (mlirVar);
16111610 assert (nonPrivateVar);
1612- moduleTranslation.mapValue (privateDecls[i].getCopyMoldArg (),
1613- nonPrivateVar);
1611+ moduleTranslation.mapValue (decl.getCopyMoldArg (), nonPrivateVar);
16141612
16151613 // map copyRegion lhs arg
1616- moduleTranslation.mapValue (privateDecls[i].getCopyPrivateArg (),
1617- llvmPrivateVars[i]);
1614+ moduleTranslation.mapValue (decl.getCopyPrivateArg (), llvmVar);
16181615
16191616 // in-place convert copy region
16201617 builder.SetInsertPoint (builder.GetInsertBlock ()->getTerminator ());
@@ -1936,24 +1933,21 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
19361933 splitBB (builder, /* CreateBranch=*/ true , " omp.private.copy" );
19371934 builder.SetInsertPoint (copyBlock->getFirstNonPHIOrDbgOrAlloca ());
19381935 }
1939- for (unsigned i = 0 ; i < privateBlockArgs. size (); ++i) {
1940- if (privateDecls[i]. getDataSharingType () !=
1941- omp::DataSharingClauseType::FirstPrivate)
1936+ for (auto [decl, mlirVar, llvmVar] :
1937+ llvm::zip_equal (privateDecls, mlirPrivateVars, llvmPrivateVars)) {
1938+ if (decl. getDataSharingType () != omp::DataSharingClauseType::FirstPrivate)
19421939 continue ;
19431940
19441941 // copyRegion implements `lhs = rhs`
1945- Region ©Region = privateDecls[i] .getCopyRegion ();
1942+ Region ©Region = decl .getCopyRegion ();
19461943
19471944 // map copyRegion rhs arg
1948- llvm::Value *nonPrivateVar =
1949- moduleTranslation.lookupValue (opInst.getPrivateVars ()[i]);
1945+ llvm::Value *nonPrivateVar = moduleTranslation.lookupValue (mlirVar);
19501946 assert (nonPrivateVar);
1951- moduleTranslation.mapValue (privateDecls[i].getCopyMoldArg (),
1952- nonPrivateVar);
1947+ moduleTranslation.mapValue (decl.getCopyMoldArg (), nonPrivateVar);
19531948
19541949 // map copyRegion lhs arg
1955- moduleTranslation.mapValue (privateDecls[i].getCopyPrivateArg (),
1956- llvmPrivateVars[i]);
1950+ moduleTranslation.mapValue (decl.getCopyPrivateArg (), llvmVar);
19571951
19581952 // in-place convert copy region
19591953 builder.SetInsertPoint (builder.GetInsertBlock ()->getTerminator ());
0 commit comments