[llvm] [MergeFuncs] Don't introduce calls to {linkonce,weak}_odr functions. (PR #125050)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 09:11:24 PST 2025


================
@@ -891,8 +891,10 @@ bool MergeFunctions::writeThunkOrAlias(Function *F, Function *G) {
 
 // Merge two equivalent functions. Upon completion, Function G is deleted.
 void MergeFunctions::mergeTwoFunctions(Function *F, Function *G) {
-  if (F->isInterposable()) {
-    assert(G->isInterposable());
+  if (F->isInterposable() || G->hasWeakODRLinkage() ||
----------------
teresajohnson wrote:

I'm not familiar with this code - what is this guarding? And is it intended that you are checking F in the first check but G in the newly added checks?

Do we need to worry about AvailableExternallyLinkage? ThinLTO converts non-prevailing linkonce_odr and those won't stick around as out of line copies, so might be ok as I think the infinite loop you are describing can't happen in that case?

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


More information about the llvm-commits mailing list