[llvm] 8dc64e9 - llvm-reduce: Avoid double map lookup (#133447)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 28 16:52:14 PDT 2025


Author: Matt Arsenault
Date: 2025-03-29T06:52:11+07:00
New Revision: 8dc64e93cb203904c778ba7c390f8b7adc85bb02

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

LOG: llvm-reduce: Avoid double map lookup (#133447)

Added: 
    

Modified: 
    llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
index 38352d6342d4f..9dcf722fd1d90 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDIMetadata.cpp
@@ -39,7 +39,7 @@ void identifyUninterestingMDNodes(Oracle &O, MDNodeList &MDs) {
     MDNode *MD = ToLook.back();
     ToLook.pop_back();
 
-    if (Visited.count(MD))
+    if (!Visited.insert(MD))
       continue;
 
     // Determine if the current MDNode is DebugInfo
@@ -55,8 +55,6 @@ void identifyUninterestingMDNodes(Oracle &O, MDNodeList &MDs) {
     for (Metadata *Op : MD->operands())
       if (MDNode *OMD = dyn_cast_or_null<MDNode>(Op))
         ToLook.push_back(OMD);
-
-    Visited.insert(MD);
   }
 
   for (auto &T : Tuples) {


        


More information about the llvm-commits mailing list