1; RUN: llc -mtriple=mipsel-linux-gnu -O3 -relocation-model=pic < %s | FileCheck %s
2
3; Test that a load comes after a store to the same memory location when passing
4; a byVal parameter to a function which has a fastcc function call
5
6%struct.str = type { i32, i32, [3 x i32*] }
7
8declare fastcc void @_Z1F3str(%struct.str* noalias nocapture sret(%struct.str) %agg.result, %struct.str* byval(%struct.str) nocapture readonly align 4 %s)
9
10define i32 @_Z1g3str(%struct.str* byval(%struct.str) nocapture readonly align 4 %s) {
11; CHECK-LABEL: _Z1g3str:
12; CHECK: sw  $7, [[OFFSET:[0-9]+]]($sp)
13; CHECK: lw  ${{[0-9]+}}, [[OFFSET]]($sp)
14entry:
15  %ref.tmp = alloca %struct.str, align 4
16  %0 = bitcast %struct.str* %ref.tmp to i8*
17  call void @llvm.lifetime.start.p0i8(i64 20, i8* nonnull %0)
18  call fastcc void @_Z1F3str(%struct.str* nonnull sret(%struct.str) %ref.tmp, %struct.str* byval(%struct.str) nonnull align 4 %s)
19  %cl.sroa.3.0..sroa_idx2 = getelementptr inbounds %struct.str, %struct.str* %ref.tmp, i32 0, i32 1
20  %cl.sroa.3.0.copyload = load i32, i32* %cl.sroa.3.0..sroa_idx2, align 4
21  call void @llvm.lifetime.end.p0i8(i64 20, i8* nonnull %0)
22  ret i32 %cl.sroa.3.0.copyload
23}
24
25declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
26
27declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
28