[llvm] [Analysis] Simplify code with DenseMap::operator[] (NFC) (PR #112082)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 23:08:54 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/112082

None

>From e025d51289f65f6cbe03d1e525d7de46a28e11c4 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 11 Oct 2024 23:03:16 -0700
Subject: [PATCH] [Analysis] Simplify code with DenseMap::operator[] (NFC)

---
 llvm/lib/Analysis/AssumptionCache.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/llvm/lib/Analysis/AssumptionCache.cpp b/llvm/lib/Analysis/AssumptionCache.cpp
index 9c86ef13f6df03..a0e57ab741dfa8 100644
--- a/llvm/lib/Analysis/AssumptionCache.cpp
+++ b/llvm/lib/Analysis/AssumptionCache.cpp
@@ -50,9 +50,7 @@ AssumptionCache::getOrInsertAffectedValues(Value *V) {
   if (AVI != AffectedValues.end())
     return AVI->second;
 
-  auto AVIP = AffectedValues.insert(
-      {AffectedValueCallbackVH(V, this), SmallVector<ResultElem, 1>()});
-  return AVIP.first->second;
+  return AffectedValues[AffectedValueCallbackVH(V, this)];
 }
 
 static void



More information about the llvm-commits mailing list