[llvm] 64ecf85 - [LVI] Use find_as() where possible (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 20 04:05:58 PDT 2020


Author: Nikita Popov
Date: 2020-06-20T13:05:42+02:00
New Revision: 64ecf85f63ef5613fe25ef7e0466c60f7d9c1908

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

LOG: [LVI] Use find_as() where possible (NFC)

This prevents us from creating temporary PoisoningVHs and
AssertingVHs while performing hashmap lookups. As such, it only
matters in assertion-enabled builds.

Added: 
    

Modified: 
    llvm/lib/Analysis/LazyValueInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index 65da4ad76430..eb0bb267b585 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -168,14 +168,14 @@ namespace {
     DenseSet<LVIValueHandle, DenseMapInfo<Value *>> ValueHandles;
 
     const BlockCacheEntry *getBlockEntry(BasicBlock *BB) const {
-      auto It = BlockCache.find(BB);
+      auto It = BlockCache.find_as(BB);
       if (It == BlockCache.end())
         return nullptr;
       return It->second.get();
     }
 
     BlockCacheEntry *getOrCreateBlockEntry(BasicBlock *BB) {
-      auto It = BlockCache.find(BB);
+      auto It = BlockCache.find_as(BB);
       if (It == BlockCache.end())
         It = BlockCache.insert({ BB, std::make_unique<BlockCacheEntry>() })
                        .first;
@@ -209,7 +209,7 @@ namespace {
       if (Entry->OverDefined.count(V))
         return ValueLatticeElement::getOverdefined();
 
-      auto LatticeIt = Entry->LatticeElements.find(V);
+      auto LatticeIt = Entry->LatticeElements.find_as(V);
       if (LatticeIt == Entry->LatticeElements.end())
         return None;
 
@@ -290,7 +290,7 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc,
     if (ToUpdate == NewSucc) continue;
 
     // If a value was marked overdefined in OldSucc, and is here too...
-    auto OI = BlockCache.find(ToUpdate);
+    auto OI = BlockCache.find_as(ToUpdate);
     if (OI == BlockCache.end() || OI->second->OverDefined.empty())
       continue;
     auto &ValueSet = OI->second->OverDefined;


        


More information about the llvm-commits mailing list