@@ -1597,24 +1597,21 @@ convertOmpTaskOp(omp::TaskOp taskOp, llvm::IRBuilderBase &builder,
1597
1597
splitBB (builder, /* CreateBranch=*/ true , " omp.private.copy" );
1598
1598
builder.SetInsertPoint (copyBlock->getFirstNonPHIOrDbgOrAlloca ());
1599
1599
}
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)
1603
1603
continue ;
1604
1604
1605
1605
// copyRegion implements `lhs = rhs`
1606
- Region ©Region = privateDecls[i] .getCopyRegion ();
1606
+ Region ©Region = decl .getCopyRegion ();
1607
1607
1608
1608
// map copyRegion rhs arg
1609
- llvm::Value *nonPrivateVar =
1610
- moduleTranslation.lookupValue (taskOp.getPrivateVars ()[i]);
1609
+ llvm::Value *nonPrivateVar = moduleTranslation.lookupValue (mlirVar);
1611
1610
assert (nonPrivateVar);
1612
- moduleTranslation.mapValue (privateDecls[i].getCopyMoldArg (),
1613
- nonPrivateVar);
1611
+ moduleTranslation.mapValue (decl.getCopyMoldArg (), nonPrivateVar);
1614
1612
1615
1613
// map copyRegion lhs arg
1616
- moduleTranslation.mapValue (privateDecls[i].getCopyPrivateArg (),
1617
- llvmPrivateVars[i]);
1614
+ moduleTranslation.mapValue (decl.getCopyPrivateArg (), llvmVar);
1618
1615
1619
1616
// in-place convert copy region
1620
1617
builder.SetInsertPoint (builder.GetInsertBlock ()->getTerminator ());
@@ -1936,24 +1933,21 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
1936
1933
splitBB (builder, /* CreateBranch=*/ true , " omp.private.copy" );
1937
1934
builder.SetInsertPoint (copyBlock->getFirstNonPHIOrDbgOrAlloca ());
1938
1935
}
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)
1942
1939
continue ;
1943
1940
1944
1941
// copyRegion implements `lhs = rhs`
1945
- Region ©Region = privateDecls[i] .getCopyRegion ();
1942
+ Region ©Region = decl .getCopyRegion ();
1946
1943
1947
1944
// map copyRegion rhs arg
1948
- llvm::Value *nonPrivateVar =
1949
- moduleTranslation.lookupValue (opInst.getPrivateVars ()[i]);
1945
+ llvm::Value *nonPrivateVar = moduleTranslation.lookupValue (mlirVar);
1950
1946
assert (nonPrivateVar);
1951
- moduleTranslation.mapValue (privateDecls[i].getCopyMoldArg (),
1952
- nonPrivateVar);
1947
+ moduleTranslation.mapValue (decl.getCopyMoldArg (), nonPrivateVar);
1953
1948
1954
1949
// map copyRegion lhs arg
1955
- moduleTranslation.mapValue (privateDecls[i].getCopyPrivateArg (),
1956
- llvmPrivateVars[i]);
1950
+ moduleTranslation.mapValue (decl.getCopyPrivateArg (), llvmVar);
1957
1951
1958
1952
// in-place convert copy region
1959
1953
builder.SetInsertPoint (builder.GetInsertBlock ()->getTerminator ());
0 commit comments