[llvm] [InstCombine] Simplify code with SmallMapVector::operator[] (NFC) (PR #113022)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 18 22:13:07 PDT 2024


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

None

>From bd0d1a94525f0effbd90b2ddcb5443e29b5d0a08 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 18 Oct 2024 08:58:49 -0700
Subject: [PATCH] [InstCombine] Simplify code with SmallMapVector::operator[]
 (NFC)

---
 llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 72ebd9fbb6d9e5..d9d41e052a32a6 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -870,8 +870,7 @@ bool InstCombinerImpl::foldAllocaCmp(AllocaInst *Alloca) {
       if (ICmp && ICmp->isEquality() && getUnderlyingObject(*U) == Alloca) {
         // Collect equality icmps of the alloca, and don't treat them as
         // captures.
-        auto Res = ICmps.insert({ICmp, 0});
-        Res.first->second |= 1u << U->getOperandNo();
+        ICmps[ICmp] |= 1u << U->getOperandNo();
         return false;
       }
 



More information about the llvm-commits mailing list