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 ptr] }
8 declare fastcc void @_Z1F3str(ptr noalias nocapture sret(%struct.str) %agg.result, ptr byval(%struct.str) nocapture readonly align 4 %s)
10 define i32 @_Z1g3str(ptr 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)
15 %ref.tmp = alloca %struct.str, align 4
16 call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %ref.tmp)
17 call fastcc void @_Z1F3str(ptr nonnull sret(%struct.str) %ref.tmp, ptr byval(%struct.str) nonnull align 4 %s)
18 %cl.sroa.3.0..sroa_idx2 = getelementptr inbounds %struct.str, ptr %ref.tmp, i32 0, i32 1
19 %cl.sroa.3.0.copyload = load i32, ptr %cl.sroa.3.0..sroa_idx2, align 4
20 call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %ref.tmp)
21 ret i32 %cl.sroa.3.0.copyload
24 declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
26 declare void @llvm.lifetime.end.p0(i64, ptr nocapture)