[llvm] [Utils] Identity map module-level debug info on first use in CloneFunction* (PR #118627)
Felipe de Azevedo Piovezan via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 22 08:34:12 PST 2025
================
@@ -899,6 +901,14 @@ std::optional<Metadata *> Mapper::mapSimpleMetadata(const Metadata *MD) {
return wrapConstantAsMetadata(*CMD, mapValue(CMD->getValue()));
}
+ // Map metadata from IdentityMD on first use. We need to add these nodes to
+ // the mapping as otherwise metadata nodes numbering gets messed up. This is
+ // still economical because the amount of data in IdentityMD may be a lot
+ // larger than what will actually get used.
+ if (IdentityMD && IdentityMD->contains(MD)) {
+ return getVM().MD()[MD] = TrackingMDRef(const_cast<Metadata *>(MD));
+ }
----------------
felipepiovezan wrote:
[Don’t Use Braces on Simple Single-Statement Bodies of if/else/loop Statements](https://llvm.org/docs/CodingStandards.html#id60)
https://github.com/llvm/llvm-project/pull/118627
More information about the llvm-commits
mailing list