fa7f052f7ffd0244375949c06b2795c0253cf21d
[oota-llvm.git] / test / Transforms / MergeFunc / apply_function_attributes.ll
1 ; RUN: opt -S -mergefunc < %s | FileCheck %s
2
3 %Opaque_type = type opaque
4 %S2i = type <{ i64, i64 }>
5 %D2i = type <{ i64, i64 }>
6 %Di = type <{ i32 }>
7 %Si = type <{ i32 }>
8
9 define void @B(%Opaque_type* sret %a, %S2i* %b, i32* %xp, i32* %yp) {
10   %x = load i32, i32* %xp
11   %y = load i32, i32* %yp
12   %sum = add i32 %x, %y
13   %sum2 = add i32 %sum, %y
14   %sum3 = add i32 %sum2, %y
15   ret void
16 }
17
18 define void @C(%Opaque_type* sret %a, %S2i* %b, i32* %xp, i32* %yp) {
19   %x = load i32, i32* %xp
20   %y = load i32, i32* %yp
21   %sum = add i32 %x, %y
22   %sum2 = add i32 %sum, %y
23   %sum3 = add i32 %sum2, %y
24   ret void
25 }
26
27 define void @A(%Opaque_type* sret %a, %D2i* %b, i32* %xp, i32* %yp) {
28   %x = load i32, i32* %xp
29   %y = load i32, i32* %yp
30   %sum = add i32 %x, %y
31   %sum2 = add i32 %sum, %y
32   %sum3 = add i32 %sum2, %y
33   ret void
34 }
35
36 ; Make sure we transfer the parameter attributes to the call site.
37 ; CHECK-LABEL: define void @C(%Opaque_type* sret
38 ; CHECK:  tail call void bitcast (void (%Opaque_type*, %D2i*, i32*, i32*)* @A to void (%Opaque_type*, %S2i*, i32*, i32*)*)(%Opaque_type* sret %0, %S2i* %1, i32* %2, i32* %3)
39 ; CHECK:  ret void
40