[Mlir-commits] [mlir] 01a0e85 - [Conversion] Avoid repeated hash lookups (NFC) (#111637)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Oct 9 06:46:11 PDT 2024


Author: Kazu Hirata
Date: 2024-10-09T06:46:07-07:00
New Revision: 01a0e85ab7183144816bd569b7ab3899663b3a0c

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

LOG: [Conversion] Avoid repeated hash lookups (NFC) (#111637)

Added: 
    

Modified: 
    mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp b/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
index 2bcd082fb3e82f..dece254c325fcd 100644
--- a/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
+++ b/mlir/lib/Conversion/SCFToGPU/SCFToGPU.cpp
@@ -509,12 +509,11 @@ static LogicalResult processParallelLoop(
                   ensureLaunchIndependent(cloningMap.lookupOrDefault(step))});
           // todo(herhut,ravishankarm): Update the behavior of setMappingAttr
           // when this condition is relaxed.
-          if (bounds.contains(processor)) {
+          if (!bounds.try_emplace(processor, launchBound).second) {
             return rewriter.notifyMatchFailure(
                 parallelOp, "cannot redefine the bound for processor " +
                                 Twine(static_cast<int64_t>(processor)));
           }
-          bounds[processor] = launchBound;
         }
         if (!boundIsPrecise) {
           // We are using an approximation, create a surrounding conditional.


        


More information about the Mlir-commits mailing list