Skip to content

Commit e5c826f

Browse files
committed
!fixup also include linkonce_odr
1 parent 3133b6b commit e5c826f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

llvm/lib/Transforms/IPO/MergeFunctions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,8 @@ bool MergeFunctions::writeThunkOrAlias(Function *F, Function *G) {
891891

892892
// Merge two equivalent functions. Upon completion, Function G is deleted.
893893
void MergeFunctions::mergeTwoFunctions(Function *F, Function *G) {
894-
if (F->isInterposable() || G->hasWeakODRLinkage()) {
895-
assert(G->isInterposable() || G->hasWeakODRLinkage());
894+
if (F->isInterposable() || G->hasWeakODRLinkage() || G->hasLinkOnceODRLinkage()) {
895+
assert(G->isInterposable() || G->hasWeakODRLinkage()|| G->hasLinkOnceODRLinkage());
896896

897897
// Both writeThunkOrAlias() calls below must succeed, either because we can
898898
// create aliases for G and NewF, or because a thunk for F is profitable.

llvm/test/Transforms/MergeFunc/comdat.ll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ define linkonce_odr hidden i32 @g(i32 %x, i32 %y) comdat {
1919
ret i32 %sum3
2020
}
2121

22-
; CHECK-DAG: define linkonce_odr hidden i32 @f(i32 %x, i32 %y) comdat
23-
; CHECK-DAG: define linkonce_odr hidden i32 @g(i32 %0, i32 %1) comdat
22+
; CHECK-DAG: define private i32 @0(i32 %x, i32 %y) comdat($f)
23+
; CHECK-DAG: define linkonce_odr hidden i32 @g(i32 %0, i32 %1) comdat {
24+
; CHECK-DAG: define linkonce_odr hidden i32 @f(i32 %0, i32 %1) {
2425

0 commit comments

Comments
 (0)