Skip to content
This repository was archived by the owner on Feb 21, 2026. It is now read-only.

[CIR][CodeGen] Use MapVector instead of StringMap for Replacements#2116

Merged
bcardosolopes merged 1 commit intollvm:mainfrom
xaerru:assertion-clamr_cpuonly
Feb 17, 2026
Merged

[CIR][CodeGen] Use MapVector instead of StringMap for Replacements#2116
bcardosolopes merged 1 commit intollvm:mainfrom
xaerru:assertion-clamr_cpuonly

Conversation

@xaerru
Copy link
Copy Markdown
Contributor

@xaerru xaerru commented Feb 10, 2026

Fix #1938

Minimized benchmark:

#include <vector>

class my_class {
public:
    std::vector<void*> my_vec;
};

my_class inst;

When using llvm::StringMap transitive replacements may be out of order. So use llvm::MapVector which is also used in clang's CodeGen.

llvm::MapVector<StringRef, llvm::TrackingVH<llvm::Constant>> Replacements;

I couldn't reproduce the MRE with #include "std-cxx.h", any other way to add the test?

@xaerru
Copy link
Copy Markdown
Contributor Author

xaerru commented Feb 17, 2026

Ping.

@bcardosolopes
Copy link
Copy Markdown
Member

Hi @xaerru, can you send this to upstream? https://discourse.llvm.org/t/clangir-transition-plans-for-the-clangir-incubator/89583/2, I'm gonna accept+merge this given it's a bug fix, but it'd be great it that fixed upstream too.

Copy link
Copy Markdown
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bcardosolopes bcardosolopes merged commit 4b3e543 into llvm:main Feb 17, 2026
7 checks passed
@xaerru xaerru deleted the assertion-clamr_cpuonly branch February 18, 2026 06:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CIR] Assertion failure on alias replacement in clamr_cpuonly.cpp

2 participants