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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 9 22:34:08 PST 2024


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

None

>From d43ad07375f30ab11265ab8f73c6065e0c0871b5 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 9 Nov 2024 15:06:55 -0800
Subject: [PATCH] [Vectorize] Simplify code with DenseMap::operator[] (NFC)

---
 llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp b/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
index dd005682203b75..f653269713b30b 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
@@ -297,12 +297,12 @@ void UnrollState::unrollRecipeByUF(VPRecipeBase &R) {
     if (auto *Red = dyn_cast<VPReductionRecipe>(&R)) {
       auto *Phi = cast<VPReductionPHIRecipe>(R.getOperand(0));
       if (Phi->isOrdered()) {
-        auto Ins = VPV2Parts.insert({Phi, {}});
+        auto &Parts = VPV2Parts[Phi];
         if (Part == 1) {
-          Ins.first->second.clear();
-          Ins.first->second.push_back(Red);
+          Parts.clear();
+          Parts.push_back(Red);
         }
-        Ins.first->second.push_back(Copy->getVPSingleValue());
+        Parts.push_back(Copy->getVPSingleValue());
         Phi->setOperand(1, Copy->getVPSingleValue());
       }
     }



More information about the llvm-commits mailing list