1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=memcpyopt,dse -S -verify-memoryssa | FileCheck %s
5 target 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"
6 target triple = "i386-pc-linux-gnu"
8 %0 = type { x86_fp80, x86_fp80 }
10 define internal fastcc void @initialize(ptr noalias nocapture sret(%0) %agg.result) nounwind {
11 ; CHECK-LABEL: @initialize(
13 ; CHECK-NEXT: store x86_fp80 0xK00000000000000000000, ptr [[AGG_RESULT:%.*]], align 4
14 ; CHECK-NEXT: [[AGG_RESULT_15:%.*]] = getelementptr [[TMP0:%.*]], ptr [[AGG_RESULT]], i32 0, i32 1
15 ; CHECK-NEXT: store x86_fp80 0xK00000000000000000000, ptr [[AGG_RESULT_15]], align 4
16 ; CHECK-NEXT: ret void
19 store x86_fp80 0xK00000000000000000000, ptr %agg.result
20 %agg.result.15 = getelementptr %0, ptr %agg.result, i32 0, i32 1
21 store x86_fp80 0xK00000000000000000000, ptr %agg.result.15
25 declare fastcc x86_fp80 @passed_uninitialized(ptr nocapture) nounwind
27 define fastcc void @badly_optimized() nounwind {
28 ; CHECK-LABEL: @badly_optimized(
30 ; CHECK-NEXT: [[Z:%.*]] = alloca [[TMP0:%.*]], align 8
31 ; CHECK-NEXT: [[TMP:%.*]] = alloca [[TMP0]], align 8
32 ; CHECK-NEXT: [[MEMTMP:%.*]] = alloca [[TMP0]], align 8
33 ; CHECK-NEXT: call fastcc void @initialize(ptr noalias sret([[TMP0]]) [[Z]])
34 ; CHECK-NEXT: [[TMP5:%.*]] = call fastcc x86_fp80 @passed_uninitialized(ptr [[Z]])
35 ; CHECK-NEXT: ret void
40 %memtmp = alloca %0, align 8
41 call fastcc void @initialize(ptr noalias sret(%0) %memtmp)
42 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tmp, ptr align 8 %memtmp, i32 24, i1 false)
43 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %z, ptr align 8 %tmp, i32 24, i1 false)
44 %tmp5 = call fastcc x86_fp80 @passed_uninitialized(ptr %z)
48 declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind