blob: 4a55ac7422ce2df0e394dd8fbc5df245cfce4256 [file] [log] [blame]
Stefan Maksimoviced797a32018-02-22 13:40:42 +00001; 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 %agg.result, %struct.str* byval nocapture readonly align 4 %s)
9
10define 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)
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 %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
23}
24
25declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
26
27declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)