[llvm] dbe8a10 - [TypePromotion] Use return value from SmallPtrSet::insert to avoid a call to SmallPtrSet::count. NFC (#103008)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 10:14:11 PDT 2024


Author: Craig Topper
Date: 2024-08-13T10:14:07-07:00
New Revision: dbe8a10c06be56d9a2a45a08ce8c95c5f0b1c21c

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

LOG: [TypePromotion] Use return value from SmallPtrSet::insert to avoid a call to SmallPtrSet::count. NFC (#103008)

Added: 
    

Modified: 
    llvm/lib/CodeGen/TypePromotion.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TypePromotion.cpp b/llvm/lib/CodeGen/TypePromotion.cpp
index 0940759ddc421..11aa3abe90685 100644
--- a/llvm/lib/CodeGen/TypePromotion.cpp
+++ b/llvm/lib/CodeGen/TypePromotion.cpp
@@ -834,11 +834,10 @@ bool TypePromotionImpl::TryToPromote(Value *V, unsigned PromotedWidth,
     // the tree has already been explored.
     // TODO: This could limit the transform, ie if we try to promote something
     // from an i8 and fail first, before trying an i16.
-    if (AllVisited.count(V))
+    if (!AllVisited.insert(V).second)
       return false;
 
     CurrentVisited.insert(V);
-    AllVisited.insert(V);
 
     // Calls can be both sources and sinks.
     if (isSink(V))


        


More information about the llvm-commits mailing list