[llvm] eaa7b38 - [Transforms] Avoid repeated hash lookups (NFC) (#113120)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 10:36:23 PDT 2024


Author: Kazu Hirata
Date: 2024-10-21T10:36:19-07:00
New Revision: eaa7b385368fa7e3dad9b95411d04be55e71494e

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

LOG: [Transforms] Avoid repeated hash lookups (NFC) (#113120)

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
index e323b391179ee0..eaf58ea8dd9d06 100644
--- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
@@ -1462,9 +1462,12 @@ class LowerMatrixIntrinsics {
       if (!CanBeFlattened(Op))
         return;
 
-      if (match(Op, m_BinOp()) && ShapeMap.find(Op) != ShapeMap.end()) {
-        ShapeMap[Op] = ShapeMap[Op].t();
-        return;
+      if (match(Op, m_BinOp())) {
+        auto It = ShapeMap.find(Op);
+        if (It != ShapeMap.end()) {
+          It->second = It->second.t();
+          return;
+        }
       }
 
       FusedInsts.insert(cast<Instruction>(Op));


        


More information about the llvm-commits mailing list