[llvm] 2c0f463 - [Vectorize] Simplify code with DenseMap::operator[] (NFC) (#115635)

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 10 07:24:50 PST 2024


Author: Kazu Hirata
Date: 2024-11-10T07:24:47-08:00
New Revision: 2c0f463b2546a98e6215f3a85940ab9c0971d2aa

URL: https://github.com/llvm/llvm-project/commit/2c0f463b2546a98e6215f3a85940ab9c0971d2aa
DIFF: https://github.com/llvm/llvm-project/commit/2c0f463b2546a98e6215f3a85940ab9c0971d2aa.diff

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

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp

Removed: 
    


################################################################################
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