1; RUN: opt < %s -basicaa -memcpyopt -dse -S | grep "call.*initialize" | not grep memtmp
2; PR2077
3
4target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
5target triple = "i386-pc-linux-gnu"
6
7%0 = type { x86_fp80, x86_fp80 }
8
9define internal fastcc void @initialize(%0* noalias sret %agg.result) nounwind {
10entry:
11  %agg.result.03 = getelementptr %0* %agg.result, i32 0, i32 0
12  store x86_fp80 0xK00000000000000000000, x86_fp80* %agg.result.03
13  %agg.result.15 = getelementptr %0* %agg.result, i32 0, i32 1
14  store x86_fp80 0xK00000000000000000000, x86_fp80* %agg.result.15
15  ret void
16}
17
18declare fastcc x86_fp80 @passed_uninitialized(%0*) nounwind
19
20define fastcc void @badly_optimized() nounwind {
21entry:
22  %z = alloca %0
23  %tmp = alloca %0
24  %memtmp = alloca %0, align 8
25  call fastcc void @initialize(%0* noalias sret %memtmp)
26  %tmp1 = bitcast %0* %tmp to i8*
27  %memtmp2 = bitcast %0* %memtmp to i8*
28  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp1, i8* %memtmp2, i32 24, i32 8, i1 false)
29  %z3 = bitcast %0* %z to i8*
30  %tmp4 = bitcast %0* %tmp to i8*
31  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %z3, i8* %tmp4, i32 24, i32 8, i1 false)
32  %tmp5 = call fastcc x86_fp80 @passed_uninitialized(%0* %z)
33  ret void
34}
35
36declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
37