[llvm-branch-commits] [llvm] [CGData] Refactor Global Merge Functions (PR #115750)

Zhaoxuan Jiang via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 11 17:48:08 PST 2024


================
@@ -420,101 +412,79 @@ static ParamLocsVecTy computeParamInfo(
 bool GlobalMergeFunc::merge(Module &M, const StableFunctionMap *FunctionMap) {
   bool Changed = false;
 
-  // Build a map from stable function name to function.
-  StringMap<Function *> StableNameToFuncMap;
-  for (auto &F : M)
-    StableNameToFuncMap[get_stable_name(F.getName())] = &F;
-  // Track merged functions
-  DenseSet<Function *> MergedFunctions;
-
-  auto ModId = M.getModuleIdentifier();
-  for (auto &[Hash, SFS] : FunctionMap->getFunctionMap()) {
-    // Parameter locations based on the unique hash sequences
-    // across the candidates.
+  // Collect stable functions related to the current module.
+  DenseMap<stable_hash, SmallVector<Function *>> HashToFuncs;
----------------
nocchijiang wrote:

```suggestion
  DenseMap<stable_hash, SmallVector<std::pair<Function *, FunctionHashInfo>>> HashToFuncs;
```

To save the cost of `FuncToFI`. Or maybe we could put `Function *` in `FunctionHashInfo`?

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


More information about the llvm-branch-commits mailing list