[clang] [CIR][CodeGen] Use MapVector instead of StringMap for replacements (PR #181969)
Gauravsingh Sisodia via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 17 23:01:43 PST 2026
https://github.com/xaerru created https://github.com/llvm/llvm-project/pull/181969
Upstreaming https://github.com/llvm/clangir/pull/2116
>From ccbf70d980e99b681825b9f8cb6c3bf12ee884c2 Mon Sep 17 00:00:00 2001
From: Gauravsingh Sisodia <xaerru at gmail.com>
Date: Wed, 18 Feb 2026 06:56:43 +0000
Subject: [PATCH] [CIR][CodeGen] Use MapVector instead of StringMap for
replacements
---
clang/lib/CIR/CodeGen/CIRGenModule.cpp | 2 +-
clang/lib/CIR/CodeGen/CIRGenModule.h | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
index 5eda2e1398fad..dbd3c92797f23 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp
@@ -1163,7 +1163,7 @@ void CIRGenModule::replacePointerTypeArgs(cir::FuncOp oldF, cir::FuncOp newF) {
void CIRGenModule::applyReplacements() {
for (auto &i : replacements) {
- StringRef mangledName = i.first();
+ StringRef mangledName = i.first;
mlir::Operation *replacement = i.second;
mlir::Operation *entry = getGlobalValue(mangledName);
if (!entry)
diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.h b/clang/lib/CIR/CodeGen/CIRGenModule.h
index b4c1d3a10e470..5b8a105e4912f 100644
--- a/clang/lib/CIR/CodeGen/CIRGenModule.h
+++ b/clang/lib/CIR/CodeGen/CIRGenModule.h
@@ -730,8 +730,7 @@ class CIRGenModule : public CIRGenTypeCache {
llvm::StringMap<clang::GlobalDecl, llvm::BumpPtrAllocator> manglings;
// FIXME: should we use llvm::TrackingVH<mlir::Operation> here?
- typedef llvm::StringMap<mlir::Operation *> ReplacementsTy;
- ReplacementsTy replacements;
+ llvm::MapVector<StringRef, mlir::Operation *> replacements;
/// Call replaceAllUsesWith on all pairs in replacements.
void applyReplacements();
More information about the cfe-commits
mailing list