[llvm] aa77085 - [MergeFunc] Add tests for (merging weak|linkonce)_odr functions.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 06:24:28 PST 2025


Author: Florian Hahn
Date: 2025-02-24T14:24:01Z
New Revision: aa770857eead289bedc19237a0a4657d3311668d

URL: https://github.com/llvm/llvm-project/commit/aa770857eead289bedc19237a0a4657d3311668d
DIFF: https://github.com/llvm/llvm-project/commit/aa770857eead289bedc19237a0a4657d3311668d.diff

LOG: [MergeFunc] Add tests for (merging weak|linkonce)_odr functions.

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

Added: 
    llvm/test/Transforms/MergeFunc/merge-linkonce-odr-used.ll
    llvm/test/Transforms/MergeFunc/merge-linkonce-odr-weak-odr-mixed-used.ll
    llvm/test/Transforms/MergeFunc/merge-linkonce-odr.ll
    llvm/test/Transforms/MergeFunc/merge-weak-odr-used.ll
    llvm/test/Transforms/MergeFunc/merge-weak-odr.ll

Modified: 
    llvm/test/Transforms/MergeFunc/linkonce_odr.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/MergeFunc/linkonce_odr.ll b/llvm/test/Transforms/MergeFunc/linkonce_odr.ll
index 23305c04f7b6f..14b56a8ece30e 100644
--- a/llvm/test/Transforms/MergeFunc/linkonce_odr.ll
+++ b/llvm/test/Transforms/MergeFunc/linkonce_odr.ll
@@ -1,19 +1,13 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --version 5
 ; RUN: opt -S -passes=mergefunc < %s | FileCheck %s -implicit-check-not=funC
 
 ; Replacments should be totally ordered on the function name.
 ; If we don't do this we  can end up with one module defining a thunk for @funA
 ; and another module defining a thunk for @funB.
-;
 ; The problem with this is that the linker could then choose these two stubs
 ; each of the two modules and we end up with two stubs calling each other.
 
-; CHECK-LABEL: define linkonce_odr i32 @funA
-; CHECK-NEXT:    add
-; CHECK:         ret
 
-; CHECK-LABEL: define linkonce_odr i32 @funB
-; CHECK-NEXT:    tail call i32 @funA(i32 %0, i32 %1)
-; CHECK-NEXT:    ret
 
 define linkonce_odr i32 @funC(i32 %x, i32 %y) {
   %sum = add i32 %x, %y
@@ -40,3 +34,19 @@ define linkonce_odr i32 @funA(i32 %x, i32 %y) {
 ; @funC, however, can safely be deleted as it has no uses, and is discardable
 ; if unused.
 @take_addr_of_funB = global ptr @funB
+;.
+; CHECK: @take_addr_of_funB = global ptr @funB
+;.
+; CHECK-LABEL: define linkonce_odr i32 @funA(
+; CHECK-SAME: i32 [[X:%.*]], i32 [[Y:%.*]]) {
+; CHECK-NEXT:    [[SUM:%.*]] = add i32 [[X]], [[Y]]
+; CHECK-NEXT:    [[SUM2:%.*]] = add i32 [[X]], [[SUM]]
+; CHECK-NEXT:    [[SUM3:%.*]] = add i32 [[X]], [[SUM2]]
+; CHECK-NEXT:    ret i32 [[SUM3]]
+;
+;
+; CHECK-LABEL: define linkonce_odr i32 @funB(
+; CHECK-SAME: i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) {
+; CHECK-NEXT:    [[TMP3:%.*]] = tail call i32 @funA(i32 [[TMP0]], i32 [[TMP1]])
+; CHECK-NEXT:    ret i32 [[TMP3]]
+;

diff  --git a/llvm/test/Transforms/MergeFunc/merge-linkonce-odr-used.ll b/llvm/test/Transforms/MergeFunc/merge-linkonce-odr-used.ll
new file mode 100644
index 0000000000000..fe6a5210454b6
--- /dev/null
+++ b/llvm/test/Transforms/MergeFunc/merge-linkonce-odr-used.ll
@@ -0,0 +1,69 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --version 5
+; RUN: opt -p mergefunc -S %s | FileCheck %s
+
+ at llvm.used = appending global [3 x ptr] [ptr @linkonce_odr_caller_of_foo_1, ptr @linkonce_odr_caller_of_foo_2, ptr @linkonce_odr_caller_of_foo_3]
+
+define void @caller_of_callers(ptr %p) {
+  call void @linkonce_odr_caller_of_foo_1(ptr %p)
+  call void @linkonce_odr_caller_of_foo_2(ptr %p)
+  call void @linkonce_odr_caller_of_foo_3(ptr %p)
+  ret void
+}
+
+define linkonce_odr void @linkonce_odr_caller_of_foo_1(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+define linkonce_odr void @linkonce_odr_caller_of_foo_2(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+define linkonce_odr void @linkonce_odr_caller_of_foo_3(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+declare void @foo(ptr)
+
+;.
+; CHECK: @llvm.used = appending global [3 x ptr] [ptr @linkonce_odr_caller_of_foo_1, ptr @linkonce_odr_caller_of_foo_2, ptr @linkonce_odr_caller_of_foo_3]
+;.
+; CHECK-LABEL: define void @caller_of_callers(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define linkonce_odr void @linkonce_odr_caller_of_foo_1(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define linkonce_odr void @linkonce_odr_caller_of_foo_2(
+; CHECK-SAME: ptr [[TMP0:%.*]]) {
+; CHECK-NEXT:    tail call void @linkonce_odr_caller_of_foo_1(ptr [[TMP0]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define linkonce_odr void @linkonce_odr_caller_of_foo_3(
+; CHECK-SAME: ptr [[TMP0:%.*]]) {
+; CHECK-NEXT:    tail call void @linkonce_odr_caller_of_foo_1(ptr [[TMP0]])
+; CHECK-NEXT:    ret void
+;

diff  --git a/llvm/test/Transforms/MergeFunc/merge-linkonce-odr-weak-odr-mixed-used.ll b/llvm/test/Transforms/MergeFunc/merge-linkonce-odr-weak-odr-mixed-used.ll
new file mode 100644
index 0000000000000..63c6b22424f4c
--- /dev/null
+++ b/llvm/test/Transforms/MergeFunc/merge-linkonce-odr-weak-odr-mixed-used.ll
@@ -0,0 +1,69 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --version 5
+; RUN: opt -p mergefunc -S %s | FileCheck %s
+
+ at llvm.used = appending global [3 x ptr] [ptr @weak_odr_caller_of_foo_1, ptr @linkonce_odr_caller_of_foo_2, ptr @weak_odr_caller_of_foo_3]
+
+define void @caller_of_callers(ptr %p) {
+  call void @weak_odr_caller_of_foo_1(ptr %p)
+  call void @linkonce_odr_caller_of_foo_2(ptr %p)
+  call void @weak_odr_caller_of_foo_3(ptr %p)
+  ret void
+}
+
+define weak_odr void @weak_odr_caller_of_foo_1(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+define linkonce_odr void @linkonce_odr_caller_of_foo_2(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+define weak_odr void @weak_odr_caller_of_foo_3(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+declare void @foo(ptr)
+
+;.
+; CHECK: @llvm.used = appending global [3 x ptr] [ptr @weak_odr_caller_of_foo_1, ptr @linkonce_odr_caller_of_foo_2, ptr @weak_odr_caller_of_foo_3]
+;.
+; CHECK-LABEL: define void @caller_of_callers(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_foo_2(ptr [[P]])
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_foo_2(ptr [[P]])
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_foo_2(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define linkonce_odr void @linkonce_odr_caller_of_foo_2(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define weak_odr void @weak_odr_caller_of_foo_1(
+; CHECK-SAME: ptr [[TMP0:%.*]]) {
+; CHECK-NEXT:    tail call void @linkonce_odr_caller_of_foo_2(ptr [[TMP0]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define weak_odr void @weak_odr_caller_of_foo_3(
+; CHECK-SAME: ptr [[TMP0:%.*]]) {
+; CHECK-NEXT:    tail call void @linkonce_odr_caller_of_foo_2(ptr [[TMP0]])
+; CHECK-NEXT:    ret void
+;

diff  --git a/llvm/test/Transforms/MergeFunc/merge-linkonce-odr.ll b/llvm/test/Transforms/MergeFunc/merge-linkonce-odr.ll
new file mode 100644
index 0000000000000..13d9fe3f98f28
--- /dev/null
+++ b/llvm/test/Transforms/MergeFunc/merge-linkonce-odr.ll
@@ -0,0 +1,126 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --version 5
+; RUN: opt -p mergefunc -S %s | FileCheck %s
+
+define void @caller_of_callers(ptr %p) {
+  call void @linkonce_odr_caller_of_foo_1(ptr %p)
+  call void @linkonce_odr_caller_of_foo_2(ptr %p)
+  call void @linkonce_odr_caller_of_foo_3(ptr %p)
+
+  call void @internal_caller_of_bar_1(ptr %p)
+  call void @linkonce_odr_caller_of_bar_2(ptr %p)
+  call void @linkonce_odr_caller_of_bar_3(ptr %p)
+
+  call void @hidden_caller_of_zar_1(ptr %p)
+  call void @linkonce_odr_caller_of_zar_2(ptr %p)
+
+  ret void
+}
+
+define linkonce_odr hidden void @linkonce_odr_caller_of_foo_1(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+define linkonce_odr hidden void @linkonce_odr_caller_of_foo_2(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+define linkonce_odr hidden void @linkonce_odr_caller_of_foo_3(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+declare void @foo(ptr)
+
+define internal void @internal_caller_of_bar_1(ptr %p) {
+entry:
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  ret void
+}
+
+define linkonce_odr hidden void @linkonce_odr_caller_of_bar_2(ptr %p) {
+entry:
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  ret void
+}
+
+define linkonce_odr hidden void @linkonce_odr_caller_of_bar_3(ptr %p) {
+entry:
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  ret void
+}
+
+declare void @bar(ptr)
+
+define hidden void @hidden_caller_of_zar_1(ptr %p) {
+entry:
+  tail call void @zar(ptr %p)
+  tail call void @zar(ptr %p)
+  tail call void @zar(ptr %p)
+  ret void
+}
+
+define linkonce_odr hidden void @linkonce_odr_caller_of_zar_2(ptr %p) {
+entry:
+  tail call void @zar(ptr %p)
+  tail call void @zar(ptr %p)
+  tail call void @zar(ptr %p)
+  ret void
+}
+
+declare void @zar(ptr)
+; CHECK-LABEL: define void @caller_of_callers(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_bar_2(ptr [[P]])
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_bar_2(ptr [[P]])
+; CHECK-NEXT:    call void @linkonce_odr_caller_of_bar_2(ptr [[P]])
+; CHECK-NEXT:    call void @hidden_caller_of_zar_1(ptr [[P]])
+; CHECK-NEXT:    call void @hidden_caller_of_zar_1(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define linkonce_odr hidden void @linkonce_odr_caller_of_foo_1(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define linkonce_odr hidden void @linkonce_odr_caller_of_bar_2(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    tail call void @bar(ptr [[P]])
+; CHECK-NEXT:    tail call void @bar(ptr [[P]])
+; CHECK-NEXT:    tail call void @bar(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define hidden void @hidden_caller_of_zar_1(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    tail call void @zar(ptr [[P]])
+; CHECK-NEXT:    tail call void @zar(ptr [[P]])
+; CHECK-NEXT:    tail call void @zar(ptr [[P]])
+; CHECK-NEXT:    ret void
+;

diff  --git a/llvm/test/Transforms/MergeFunc/merge-weak-odr-used.ll b/llvm/test/Transforms/MergeFunc/merge-weak-odr-used.ll
new file mode 100644
index 0000000000000..6c2b22fd1da7d
--- /dev/null
+++ b/llvm/test/Transforms/MergeFunc/merge-weak-odr-used.ll
@@ -0,0 +1,69 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --version 5
+; RUN: opt -p mergefunc -S %s | FileCheck %s
+
+ at llvm.used = appending global [3 x ptr] [ptr @weak_odr_caller_of_foo_1, ptr @weak_odr_caller_of_foo_2, ptr @weak_odr_caller_of_foo_3]
+
+define void @caller_of_callers(ptr %p) {
+  call void @weak_odr_caller_of_foo_1(ptr %p)
+  call void @weak_odr_caller_of_foo_2(ptr %p)
+  call void @weak_odr_caller_of_foo_3(ptr %p)
+  ret void
+}
+
+define weak_odr void @weak_odr_caller_of_foo_1(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+define weak_odr void @weak_odr_caller_of_foo_2(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+define weak_odr void @weak_odr_caller_of_foo_3(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+declare void @foo(ptr)
+
+;.
+; CHECK: @llvm.used = appending global [3 x ptr] [ptr @weak_odr_caller_of_foo_1, ptr @weak_odr_caller_of_foo_2, ptr @weak_odr_caller_of_foo_3]
+;.
+; CHECK-LABEL: define void @caller_of_callers(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:    call void @weak_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    call void @weak_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    call void @weak_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define weak_odr void @weak_odr_caller_of_foo_1(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define weak_odr void @weak_odr_caller_of_foo_2(
+; CHECK-SAME: ptr [[TMP0:%.*]]) {
+; CHECK-NEXT:    tail call void @weak_odr_caller_of_foo_1(ptr [[TMP0]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define weak_odr void @weak_odr_caller_of_foo_3(
+; CHECK-SAME: ptr [[TMP0:%.*]]) {
+; CHECK-NEXT:    tail call void @weak_odr_caller_of_foo_1(ptr [[TMP0]])
+; CHECK-NEXT:    ret void
+;

diff  --git a/llvm/test/Transforms/MergeFunc/merge-weak-odr.ll b/llvm/test/Transforms/MergeFunc/merge-weak-odr.ll
new file mode 100644
index 0000000000000..3ea279a411c72
--- /dev/null
+++ b/llvm/test/Transforms/MergeFunc/merge-weak-odr.ll
@@ -0,0 +1,150 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --version 5
+; RUN: opt -p mergefunc -S %s | FileCheck %s
+
+define void @caller_of_callers(ptr %p) {
+  call void @weak_odr_caller_of_foo_1(ptr %p)
+  call void @weak_odr_caller_of_foo_2(ptr %p)
+  call void @weak_odr_caller_of_foo_3(ptr %p)
+
+  call void @internal_caller_of_bar_1(ptr %p)
+  call void @weak_odr_caller_of_bar_2(ptr %p)
+  call void @weak_odr_caller_of_bar_3(ptr %p)
+
+  call void @hidden_caller_of_zar_1(ptr %p)
+  call void @weak_odr_caller_of_zar_2(ptr %p)
+
+  ret void
+}
+
+define weak_odr hidden void @weak_odr_caller_of_foo_1(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+define weak_odr hidden void @weak_odr_caller_of_foo_2(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+define weak_odr hidden void @weak_odr_caller_of_foo_3(ptr %p) {
+entry:
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  tail call void @foo(ptr %p)
+  ret void
+}
+
+declare void @foo(ptr)
+
+define internal void @internal_caller_of_bar_1(ptr %p) {
+entry:
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  ret void
+}
+
+define weak_odr hidden void @weak_odr_caller_of_bar_2(ptr %p) {
+entry:
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  ret void
+}
+
+define weak_odr hidden void @weak_odr_caller_of_bar_3(ptr %p) {
+entry:
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  tail call void @bar(ptr %p)
+  ret void
+}
+
+declare void @bar(ptr)
+
+define hidden void @hidden_caller_of_zar_1(ptr %p) {
+entry:
+  tail call void @zar(ptr %p)
+  tail call void @zar(ptr %p)
+  tail call void @zar(ptr %p)
+  ret void
+}
+
+define weak_odr hidden void @weak_odr_caller_of_zar_2(ptr %p) {
+entry:
+  tail call void @zar(ptr %p)
+  tail call void @zar(ptr %p)
+  tail call void @zar(ptr %p)
+  ret void
+}
+
+declare void @zar(ptr)
+; CHECK-LABEL: define void @caller_of_callers(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:    call void @weak_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    call void @weak_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    call void @weak_odr_caller_of_foo_1(ptr [[P]])
+; CHECK-NEXT:    call void @weak_odr_caller_of_bar_2(ptr [[P]])
+; CHECK-NEXT:    call void @weak_odr_caller_of_bar_2(ptr [[P]])
+; CHECK-NEXT:    call void @weak_odr_caller_of_bar_2(ptr [[P]])
+; CHECK-NEXT:    call void @hidden_caller_of_zar_1(ptr [[P]])
+; CHECK-NEXT:    call void @hidden_caller_of_zar_1(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define weak_odr hidden void @weak_odr_caller_of_foo_1(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    tail call void @foo(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define weak_odr hidden void @weak_odr_caller_of_bar_2(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    tail call void @bar(ptr [[P]])
+; CHECK-NEXT:    tail call void @bar(ptr [[P]])
+; CHECK-NEXT:    tail call void @bar(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define hidden void @hidden_caller_of_zar_1(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    tail call void @zar(ptr [[P]])
+; CHECK-NEXT:    tail call void @zar(ptr [[P]])
+; CHECK-NEXT:    tail call void @zar(ptr [[P]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define weak_odr hidden void @weak_odr_caller_of_foo_2(
+; CHECK-SAME: ptr [[TMP0:%.*]]) {
+; CHECK-NEXT:    tail call void @weak_odr_caller_of_foo_1(ptr [[TMP0]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define weak_odr hidden void @weak_odr_caller_of_foo_3(
+; CHECK-SAME: ptr [[TMP0:%.*]]) {
+; CHECK-NEXT:    tail call void @weak_odr_caller_of_foo_1(ptr [[TMP0]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define weak_odr hidden void @weak_odr_caller_of_bar_3(
+; CHECK-SAME: ptr [[TMP0:%.*]]) {
+; CHECK-NEXT:    tail call void @weak_odr_caller_of_bar_2(ptr [[TMP0]])
+; CHECK-NEXT:    ret void
+;
+;
+; CHECK-LABEL: define weak_odr hidden void @weak_odr_caller_of_zar_2(
+; CHECK-SAME: ptr [[TMP0:%.*]]) {
+; CHECK-NEXT:    tail call void @hidden_caller_of_zar_1(ptr [[TMP0]])
+; CHECK-NEXT:    ret void
+;


        


More information about the llvm-commits mailing list