[llvm] [Utils] Identity map module-level debug info on first use in CloneFunction* (PR #118627)

Artem Pianykh via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 12:50:31 PST 2025


================
@@ -322,16 +317,21 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
   DISubprogram *SPClonedWithinModule =
       CollectDebugInfoForCloning(*OldFunc, Changes, DIFinder);
 
-  ModuleLevelChanges =
-      BuildDebugInfoMDMap(VMap.MD(), Changes, DIFinder, SPClonedWithinModule);
+  MetadataSetTy IdentityMD;
+  FindDebugInfoToIdentityMap(IdentityMD, Changes, DIFinder,
+                             SPClonedWithinModule);
 
-  const auto RemapFlag = ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges;
+  // Current implementation always upgrades from local changes to module level
+  // changes due to the way metadata cloning is done. See
+  // BuildDebugInfoToIdentityMap for more details.
----------------
artempyanykh wrote:

> I can't find `BuildDebugInfoToIdentityMap` in this patch

Yes, sorry, this was renamed to `FindDebugInfoToIdentityMap`.

--

Updated the comment with the suggestion.

https://github.com/llvm/llvm-project/pull/118627


More information about the llvm-commits mailing list