[llvm] [ConstantHoisting] Remove redundant cleanup (NFC) (PR #173823)

via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 28 21:35:33 PST 2025


https://github.com/sfu2 updated https://github.com/llvm/llvm-project/pull/173823

>From 21091d8d3540873c2f9a3013739dd9a340edff56 Mon Sep 17 00:00:00 2001
From: sfu <afwbu8tp6 at mozmail.com>
Date: Mon, 29 Dec 2025 05:00:40 +0000
Subject: [PATCH] [ConstantHoisting] Remove redundant cleanup (NFC)

ConstGEPCandMap and ConstGEPInfoMap of type MapVector will free up
the inner vector/SmallVector when calling clear(). Existing for-loops
introduce redundant container copy and ineffective cleanup.
---
 llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h b/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
index a40f0e220044c..e597665661e34 100644
--- a/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
+++ b/llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
@@ -135,12 +135,8 @@ class ConstantHoistingPass : public PassInfoMixin<ConstantHoistingPass> {
   void cleanup() {
     ClonedCastMap.clear();
     ConstIntCandVec.clear();
-    for (auto MapEntry : ConstGEPCandMap)
-      MapEntry.second.clear();
     ConstGEPCandMap.clear();
     ConstIntInfoVec.clear();
-    for (auto MapEntry : ConstGEPInfoMap)
-      MapEntry.second.clear();
     ConstGEPInfoMap.clear();
   }
 



More information about the llvm-commits mailing list