[clang] [CIR][CodeGen] Use MapVector instead of StringMap for replacements (PR #181969)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 17 23:02:14 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Gauravsingh Sisodia (xaerru)
<details>
<summary>Changes</summary>
Upstreaming https://github.com/llvm/clangir/pull/2116
---
Full diff: https://github.com/llvm/llvm-project/pull/181969.diff
2 Files Affected:
- (modified) clang/lib/CIR/CodeGen/CIRGenModule.cpp (+1-1)
- (modified) clang/lib/CIR/CodeGen/CIRGenModule.h (+1-2)
``````````diff
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();
``````````
</details>
https://github.com/llvm/llvm-project/pull/181969
More information about the cfe-commits
mailing list