1 ; RUN: opt -S -argpromotion < %s | FileCheck %s
2 ; RUN: opt -S -passes=argpromotion < %s | FileCheck %s
3 ; Test that we only promote arguments when the caller/callee have compatible
6 target triple = "x86_64-unknown-linux-gnu"
8 ; CHECK-LABEL: @no_promote_avx2(<4 x i64>* %arg, <4 x i64>* readonly %arg1)
9 define internal fastcc void @no_promote_avx2(<4 x i64>* %arg, <4 x i64>* readonly %arg1) #0 {
11 %tmp = load <4 x i64>, <4 x i64>* %arg1
12 store <4 x i64> %tmp, <4 x i64>* %arg
16 define void @no_promote(<4 x i64>* %arg) #1 {
18 %tmp = alloca <4 x i64>, align 32
19 %tmp2 = alloca <4 x i64>, align 32
20 %tmp3 = bitcast <4 x i64>* %tmp to i8*
21 call void @llvm.memset.p0i8.i64(i8* align 32 %tmp3, i8 0, i64 32, i1 false)
22 call fastcc void @no_promote_avx2(<4 x i64>* %tmp2, <4 x i64>* %tmp)
23 %tmp4 = load <4 x i64>, <4 x i64>* %tmp2, align 32
24 store <4 x i64> %tmp4, <4 x i64>* %arg, align 2
28 ; CHECK-LABEL: @promote_avx2(<4 x i64>* %arg, <4 x i64> %
29 define internal fastcc void @promote_avx2(<4 x i64>* %arg, <4 x i64>* readonly %arg1) #0 {
31 %tmp = load <4 x i64>, <4 x i64>* %arg1
32 store <4 x i64> %tmp, <4 x i64>* %arg
36 define void @promote(<4 x i64>* %arg) #0 {
38 %tmp = alloca <4 x i64>, align 32
39 %tmp2 = alloca <4 x i64>, align 32
40 %tmp3 = bitcast <4 x i64>* %tmp to i8*
41 call void @llvm.memset.p0i8.i64(i8* align 32 %tmp3, i8 0, i64 32, i1 false)
42 call fastcc void @promote_avx2(<4 x i64>* %tmp2, <4 x i64>* %tmp)
43 %tmp4 = load <4 x i64>, <4 x i64>* %tmp2, align 32
44 store <4 x i64> %tmp4, <4 x i64>* %arg, align 2
48 ; Function Attrs: argmemonly nounwind
49 declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1) #2
51 attributes #0 = { inlinehint norecurse nounwind uwtable "target-features"="+avx2" }
52 attributes #1 = { nounwind uwtable }
53 attributes #2 = { argmemonly nounwind }