[PATCH] D127751: [MergeFunctions] Preserve symbols used llvm.used/llvm.compiler.used

Amanieu d'Antras via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 09:22:06 PDT 2022


Amanieu added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/MergeFunctions.cpp:862
+        if (CompilerUsed.contains(G))
+          appendToCompilerUsed(*G->getParent(), {G});
       } else {
----------------
nikic wrote:
> So does this just leave the old function behind, effectively not doing a merge? I think what you actually want is to go into the alias/thunk code path in this case.
The writeThunkOrAlias call below will replace the old function with a thunk or alias. Adding the old function back to llvm.used will cause the `G->use_empty()` condition below to fail which prevents the function from being removed from the IR.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127751/new/

https://reviews.llvm.org/D127751



More information about the llvm-commits mailing list