1; RUN: opt -mergefunc -S < %s | FileCheck %s
2
3; CHECK-LABEL: @int_ptr_arg_different
4; CHECK-NEXT: call void asm
5
6; CHECK-LABEL: @int_ptr_null
7; CHECK-NEXT: tail call void @float_ptr_null()
8
9; CHECK-LABEL: @int_ptr_arg_same
10; CHECK-NEXT: %2 = bitcast i32* %0 to float*
11; CHECK-NEXT: tail call void @float_ptr_arg_same(float* %2)
12
13; Used to satisfy minimum size limit
14declare void @stuff()
15
16; Can be merged
17define void @float_ptr_null() {
18  call void asm "nop", "r"(float* null)
19  call void @stuff()
20  ret void
21}
22
23define void @int_ptr_null() {
24  call void asm "nop", "r"(i32* null)
25  call void @stuff()
26  ret void
27}
28
29; Can be merged (uses same argument differing by pointer type)
30define void @float_ptr_arg_same(float*) {
31  call void asm "nop", "r"(float* %0)
32  call void @stuff()
33  ret void
34}
35
36define void @int_ptr_arg_same(i32*) {
37  call void asm "nop", "r"(i32* %0)
38  call void @stuff()
39  ret void
40}
41
42; Can not be merged (uses different arguments)
43define void @float_ptr_arg_different(float*, float*) {
44  call void asm "nop", "r"(float* %0)
45  call void @stuff()
46  ret void
47}
48
49define void @int_ptr_arg_different(i32*, i32*) {
50  call void asm "nop", "r"(i32* %1)
51  call void @stuff()
52  ret void
53}
54