[Mlir-commits] [mlir] a99d666 - [MLIR][OpenMP] Replace index-based loop (NFC) (#107878)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Sep 10 02:30:52 PDT 2024


Author: Sergio Afonso
Date: 2024-09-10T10:30:47+01:00
New Revision: a99d666713ebfedf65e56bed5e87312eba6e5b11

URL: https://github.com/llvm/llvm-project/commit/a99d666713ebfedf65e56bed5e87312eba6e5b11
DIFF: https://github.com/llvm/llvm-project/commit/a99d666713ebfedf65e56bed5e87312eba6e5b11.diff

LOG: [MLIR][OpenMP] Replace index-based loop (NFC) (#107878)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index d597bbfee2fe19..2d2b3b00d2aa96 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -3428,14 +3428,12 @@ convertOmpTarget(Operation &opInst, llvm::IRBuilderBase &builder,
       llvmOutlinedFn->addFnAttr(attr);
 
     builder.restoreIP(codeGenIP);
-    unsigned argIndex = 0;
-    for (auto &mapOp : mapVars) {
+    for (auto [argIndex, mapOp] : llvm::enumerate(mapVars)) {
       auto mapInfoOp = cast<omp::MapInfoOp>(mapOp.getDefiningOp());
       llvm::Value *mapOpValue =
           moduleTranslation.lookupValue(mapInfoOp.getVarPtr());
       const auto &arg = targetRegion.front().getArgument(argIndex);
       moduleTranslation.mapValue(arg, mapOpValue);
-      argIndex++;
     }
     llvm::BasicBlock *exitBlock = convertOmpOpRegions(
         targetRegion, "omp.target", builder, moduleTranslation, bodyGenStatus);


        


More information about the Mlir-commits mailing list