[llvm] [DSE] Simplify code with MapVector::operator[] (NFC) (PR #111621)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 19:22:15 PDT 2024


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

None

>From 7e38573d02d3172b29e9820f180ecf218a64aaa5 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 8 Oct 2024 07:39:32 -0700
Subject: [PATCH] [DSE] Simplify code with MapVector::operator[] (NFC)

---
 llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index ce8c988ba531dd..6fce46a624c9c7 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -2259,10 +2259,7 @@ DSEState::eliminateDeadDefs(const MemoryLocationWrapper &KillingLocWrapper) {
                       KillingLocWrapper.MemLoc, DeadLocWrapper.MemLoc,
                       KillingOffset, DeadOffset);
       if (OR == OW_MaybePartial) {
-        auto Iter =
-            IOLs.insert(std::make_pair<BasicBlock *, InstOverlapIntervalsTy>(
-                DeadLocWrapper.DefInst->getParent(), InstOverlapIntervalsTy()));
-        auto &IOL = Iter.first->second;
+        auto &IOL = IOLs[DeadLocWrapper.DefInst->getParent()];
         OR = isPartialOverwrite(KillingLocWrapper.MemLoc, DeadLocWrapper.MemLoc,
                                 KillingOffset, DeadOffset,
                                 DeadLocWrapper.DefInst, IOL);



More information about the llvm-commits mailing list