1 ; RUN: opt < %s -memcpyopt -S | FileCheck %s
2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-grtev4-linux-gnu"
5 define i8* @foo(i8* returned %0, i32 %1, i64 %2) {
7 %3 = getelementptr inbounds i8, i8* %0, i64 %2
8 %4 = getelementptr inbounds i8, i8* %3, i64 -32
9 %vv = trunc i32 %1 to i8
10 store i8 %vv, i8* %4, align 1
11 %5 = getelementptr inbounds i8, i8* %4, i64 1
12 store i8 %vv, i8* %5, align 1
13 %6= getelementptr inbounds i8, i8* %4, i64 2
14 store i8 %vv, i8* %6, align 1
15 %7= getelementptr inbounds i8, i8* %4, i64 3
16 store i8 %vv, i8* %7, align 1
17 %8= getelementptr inbounds i8, i8* %4, i64 4
18 store i8 %vv, i8* %8, align 1
19 %9= getelementptr inbounds i8, i8* %4, i64 5
20 store i8 %vv, i8* %9, align 1
21 %10= getelementptr inbounds i8, i8* %4, i64 6
22 store i8 %vv, i8* %10, align 1
23 %11= getelementptr inbounds i8, i8* %4, i64 7
24 store i8 %vv, i8* %11, align 1
25 %12= getelementptr inbounds i8, i8* %4, i64 8
26 store i8 %vv, i8* %12, align 1
27 %13= getelementptr inbounds i8, i8* %4, i64 9
28 store i8 %vv, i8* %13, align 1
29 %14= getelementptr inbounds i8, i8* %4, i64 10
30 store i8 %vv, i8* %14, align 1
31 %15= getelementptr inbounds i8, i8* %4, i64 11
32 store i8 %vv, i8* %15, align 1
33 %16= getelementptr inbounds i8, i8* %4, i64 12
34 store i8 %vv, i8* %16, align 1
35 %17= getelementptr inbounds i8, i8* %4, i64 13
36 store i8 %vv, i8* %17, align 1
37 %18= getelementptr inbounds i8, i8* %4, i64 14
38 store i8 %vv, i8* %18, align 1
39 %19= getelementptr inbounds i8, i8* %4, i64 15
40 store i8 %vv, i8* %19, align 1
41 %20= getelementptr inbounds i8, i8* %4, i64 16
42 store i8 %vv, i8* %20, align 1
43 %21= getelementptr inbounds i8, i8* %20, i64 1
44 store i8 %vv, i8* %21, align 1
45 %22= getelementptr inbounds i8, i8* %20, i64 2
46 store i8 %vv, i8* %22, align 1
47 %23= getelementptr inbounds i8, i8* %20, i64 3
48 store i8 %vv, i8* %23, align 1
49 %24= getelementptr inbounds i8, i8* %20, i64 4
50 store i8 %vv, i8* %24, align 1
51 %25= getelementptr inbounds i8, i8* %20, i64 5
52 store i8 %vv, i8* %25, align 1
53 %26= getelementptr inbounds i8, i8* %20, i64 6
54 store i8 %vv, i8* %26, align 1
55 %27= getelementptr inbounds i8, i8* %20, i64 7
56 store i8 %vv, i8* %27, align 1
57 %28= getelementptr inbounds i8, i8* %20, i64 8
58 store i8 %vv, i8* %28, align 1
59 %29= getelementptr inbounds i8, i8* %20, i64 9
60 store i8 %vv, i8* %29, align 1
61 %30= getelementptr inbounds i8, i8* %20, i64 10
62 store i8 %vv, i8* %30, align 1
63 %31 = getelementptr inbounds i8, i8* %20, i64 11
64 store i8 %vv, i8* %31, align 1
65 %32 = getelementptr inbounds i8, i8* %20, i64 12
66 store i8 %vv, i8* %32, align 1
67 %33 = getelementptr inbounds i8, i8* %20, i64 13
68 store i8 %vv, i8* %33, align 1
69 %34 = getelementptr inbounds i8, i8* %20, i64 14
70 store i8 %vv, i8* %34, align 1
71 %35 = getelementptr inbounds i8, i8* %20, i64 15
72 store i8 %vv, i8* %35, align 1
75 ; CHECK: call void @llvm.memset.p0i8.i64(i8* align 1 %4, i8 %vv, i64 32, i1 false)