1 ; RUN: llc -mtriple=mipsel-linux-gnu -O3 -relocation-model=pic < %s | FileCheck %s
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
6 %struct.str = type { i32, i32, [3 x i32*] }
8 declare fastcc void @_Z1F3str(%struct.str* noalias nocapture sret %agg.result, %struct.str* byval nocapture readonly align 4 %s)
10 define i32 @_Z1g3str(%struct.str* byval nocapture readonly align 4 %s) {
11 ; CHECK-LABEL: _Z1g3str:
12 ; CHECK: sw $7, [[OFFSET:[0-9]+]]($sp)
13 ; CHECK: lw ${{[0-9]+}}, [[OFFSET]]($sp)
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 %ref.tmp, %struct.str* byval 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
25 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
27 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)