[Mlir-commits] [mlir] [MLIR][OpenMP] Fix MLIR->LLVM value matching in privatization logic (PR #103718)
Leandro Lupori
llvmlistbot at llvm.org
Fri Aug 16 05:58:19 PDT 2024
================
@@ -1424,35 +1424,107 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
}
};
- SmallVector<omp::PrivateClauseOp> privatizerClones;
- SmallVector<llvm::Value *> privateVariables;
+ SmallVector<omp::PrivateClauseOp> mlirPrivatizerClones;
+ SmallVector<llvm::Value *> llvmPrivateVars;
// TODO: Perform appropriate actions according to the data-sharing
// attribute (shared, private, firstprivate, ...) of variables.
// Currently shared and private are supported.
auto privCB = [&](InsertPointTy allocaIP, InsertPointTy codeGenIP,
- llvm::Value &, llvm::Value &vPtr,
- llvm::Value *&replacementValue) -> InsertPointTy {
- replacementValue = &vPtr;
+ llvm::Value &, llvm::Value &llvmOmpRegionInputPtr,
+ llvm::Value *&llvmReplacementValue) -> InsertPointTy {
+ llvmReplacementValue = &llvmOmpRegionInputPtr;
// If this is a private value, this lambda will return the corresponding
// mlir value and its `PrivateClauseOp`. Otherwise, empty values are
// returned.
- auto [privVar, privatizerClone] =
+ auto [mlirPrivVar, mlirPrivatizerClone] =
[&]() -> std::pair<mlir::Value, omp::PrivateClauseOp> {
if (!opInst.getPrivateVars().empty()) {
- auto privateVars = opInst.getPrivateVars();
- auto privateSyms = opInst.getPrivateSyms();
+ auto mlirPrivVars = opInst.getPrivateVars();
+ auto mlirPrivSyms = opInst.getPrivateSyms();
- for (auto [privVar, privatizerAttr] :
- llvm::zip_equal(privateVars, *privateSyms)) {
+ // Try to find a privatizer that corresponds to the LLVM value being
+ // prvatized.
----------------
luporl wrote:
```suggestion
// privatized.
```
https://github.com/llvm/llvm-project/pull/103718
More information about the Mlir-commits
mailing list