[llvm] [Vectorize] Simplify code with DenseMap::operator[] (NFC) (PR #113246)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 19:10:01 PDT 2024


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

None

>From c489d332ee3e7c2efd7e7817281f513398ccfc14 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 21 Oct 2024 06:59:29 -0700
Subject: [PATCH] [Vectorize] Simplify code with DenseMap::operator[] (NFC)

---
 llvm/lib/Transforms/Vectorize/VPlan.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 59a084401cc9bf..e093ede496bb1f 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -291,8 +291,7 @@ struct VPTransformState {
 
   /// Set the generated scalar \p V for \p Def and the given \p Lane.
   void set(VPValue *Def, Value *V, const VPLane &Lane) {
-    auto Iter = Data.VPV2Scalars.insert({Def, {}});
-    auto &Scalars = Iter.first->second;
+    auto &Scalars = Data.VPV2Scalars[Def];
     unsigned CacheIdx = Lane.mapToCacheIndex(VF);
     if (Scalars.size() <= CacheIdx)
       Scalars.resize(CacheIdx + 1);



More information about the llvm-commits mailing list