[llvm] 8bfd6b9 - [SSAUpdater] Use DenseMap::operator[] (NFC) (#107179)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 01:28:54 PDT 2024


Author: Kazu Hirata
Date: 2024-09-04T01:28:49-07:00
New Revision: 8bfd6b953fc119bbc37c1755e701261fcfb31ad2

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

LOG: [SSAUpdater] Use DenseMap::operator[] (NFC) (#107179)

I'm planning to deprecate DenseMap::FindAndConstruct in favor of
DenseMap::operator[].  I thought about renaming the variable to
PredInfo, but the name is taken, so I am leaving the name as is.

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h b/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
index 010d6b0de9f6af..746926e5bee331 100644
--- a/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
+++ b/llvm/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
@@ -139,17 +139,16 @@ class SSAUpdaterImpl {
       for (unsigned p = 0; p != Info->NumPreds; ++p) {
         BlkT *Pred = Preds[p];
         // Check if BBMap already has a BBInfo for the predecessor block.
-        typename BBMapTy::value_type &BBMapBucket =
-          BBMap.FindAndConstruct(Pred);
-        if (BBMapBucket.second) {
-          Info->Preds[p] = BBMapBucket.second;
+        BBInfo *&BBMapBucket = BBMap[Pred];
+        if (BBMapBucket) {
+          Info->Preds[p] = BBMapBucket;
           continue;
         }
 
         // Create a new BBInfo for the predecessor.
         ValT PredVal = AvailableVals->lookup(Pred);
         BBInfo *PredInfo = new (Allocator) BBInfo(Pred, PredVal);
-        BBMapBucket.second = PredInfo;
+        BBMapBucket = PredInfo;
         Info->Preds[p] = PredInfo;
 
         if (PredInfo->AvailableVal) {


        


More information about the llvm-commits mailing list