1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=memcpyopt -S -verify-memoryssa | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-grtev4-linux-gnu"
6 define ptr @foo(ptr returned %0, i32 %1, i64 %2) {
9 ; CHECK-NEXT: [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[TMP0:%.*]], i64 [[TMP2:%.*]]
10 ; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[TMP3]], i64 -32
11 ; CHECK-NEXT: [[VV:%.*]] = trunc i32 [[TMP1:%.*]] to i8
12 ; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 1
13 ; CHECK-NEXT: [[TMP6:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 2
14 ; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 3
15 ; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 4
16 ; CHECK-NEXT: [[TMP9:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 5
17 ; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 6
18 ; CHECK-NEXT: [[TMP11:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 7
19 ; CHECK-NEXT: [[TMP12:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 8
20 ; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 9
21 ; CHECK-NEXT: [[TMP14:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 10
22 ; CHECK-NEXT: [[TMP15:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 11
23 ; CHECK-NEXT: [[TMP16:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 12
24 ; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 13
25 ; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 14
26 ; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 15
27 ; CHECK-NEXT: [[TMP20:%.*]] = getelementptr inbounds i8, ptr [[TMP4]], i64 16
28 ; CHECK-NEXT: [[TMP21:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 1
29 ; CHECK-NEXT: [[TMP22:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 2
30 ; CHECK-NEXT: [[TMP23:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 3
31 ; CHECK-NEXT: [[TMP24:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 4
32 ; CHECK-NEXT: [[TMP25:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 5
33 ; CHECK-NEXT: [[TMP26:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 6
34 ; CHECK-NEXT: [[TMP27:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 7
35 ; CHECK-NEXT: [[TMP28:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 8
36 ; CHECK-NEXT: [[TMP29:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 9
37 ; CHECK-NEXT: [[TMP30:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 10
38 ; CHECK-NEXT: [[TMP31:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 11
39 ; CHECK-NEXT: [[TMP32:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 12
40 ; CHECK-NEXT: [[TMP33:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 13
41 ; CHECK-NEXT: [[TMP34:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 14
42 ; CHECK-NEXT: [[TMP35:%.*]] = getelementptr inbounds i8, ptr [[TMP20]], i64 15
43 ; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 1 [[TMP4]], i8 [[VV]], i64 32, i1 false)
44 ; CHECK-NEXT: ret ptr [[TMP0]]
47 %3 = getelementptr inbounds i8, ptr %0, i64 %2
48 %4 = getelementptr inbounds i8, ptr %3, i64 -32
49 %vv = trunc i32 %1 to i8
50 store i8 %vv, ptr %4, align 1
51 %5 = getelementptr inbounds i8, ptr %4, i64 1
52 store i8 %vv, ptr %5, align 1
53 %6= getelementptr inbounds i8, ptr %4, i64 2
54 store i8 %vv, ptr %6, align 1
55 %7= getelementptr inbounds i8, ptr %4, i64 3
56 store i8 %vv, ptr %7, align 1
57 %8= getelementptr inbounds i8, ptr %4, i64 4
58 store i8 %vv, ptr %8, align 1
59 %9= getelementptr inbounds i8, ptr %4, i64 5
60 store i8 %vv, ptr %9, align 1
61 %10= getelementptr inbounds i8, ptr %4, i64 6
62 store i8 %vv, ptr %10, align 1
63 %11= getelementptr inbounds i8, ptr %4, i64 7
64 store i8 %vv, ptr %11, align 1
65 %12= getelementptr inbounds i8, ptr %4, i64 8
66 store i8 %vv, ptr %12, align 1
67 %13= getelementptr inbounds i8, ptr %4, i64 9
68 store i8 %vv, ptr %13, align 1
69 %14= getelementptr inbounds i8, ptr %4, i64 10
70 store i8 %vv, ptr %14, align 1
71 %15= getelementptr inbounds i8, ptr %4, i64 11
72 store i8 %vv, ptr %15, align 1
73 %16= getelementptr inbounds i8, ptr %4, i64 12
74 store i8 %vv, ptr %16, align 1
75 %17= getelementptr inbounds i8, ptr %4, i64 13
76 store i8 %vv, ptr %17, align 1
77 %18= getelementptr inbounds i8, ptr %4, i64 14
78 store i8 %vv, ptr %18, align 1
79 %19= getelementptr inbounds i8, ptr %4, i64 15
80 store i8 %vv, ptr %19, align 1
81 %20= getelementptr inbounds i8, ptr %4, i64 16
82 store i8 %vv, ptr %20, align 1
83 %21= getelementptr inbounds i8, ptr %20, i64 1
84 store i8 %vv, ptr %21, align 1
85 %22= getelementptr inbounds i8, ptr %20, i64 2
86 store i8 %vv, ptr %22, align 1
87 %23= getelementptr inbounds i8, ptr %20, i64 3
88 store i8 %vv, ptr %23, align 1
89 %24= getelementptr inbounds i8, ptr %20, i64 4
90 store i8 %vv, ptr %24, align 1
91 %25= getelementptr inbounds i8, ptr %20, i64 5
92 store i8 %vv, ptr %25, align 1
93 %26= getelementptr inbounds i8, ptr %20, i64 6
94 store i8 %vv, ptr %26, align 1
95 %27= getelementptr inbounds i8, ptr %20, i64 7
96 store i8 %vv, ptr %27, align 1
97 %28= getelementptr inbounds i8, ptr %20, i64 8
98 store i8 %vv, ptr %28, align 1
99 %29= getelementptr inbounds i8, ptr %20, i64 9
100 store i8 %vv, ptr %29, align 1
101 %30= getelementptr inbounds i8, ptr %20, i64 10
102 store i8 %vv, ptr %30, align 1
103 %31 = getelementptr inbounds i8, ptr %20, i64 11
104 store i8 %vv, ptr %31, align 1
105 %32 = getelementptr inbounds i8, ptr %20, i64 12
106 store i8 %vv, ptr %32, align 1
107 %33 = getelementptr inbounds i8, ptr %20, i64 13
108 store i8 %vv, ptr %33, align 1
109 %34 = getelementptr inbounds i8, ptr %20, i64 14
110 store i8 %vv, ptr %34, align 1
111 %35 = getelementptr inbounds i8, ptr %20, i64 15
112 store i8 %vv, ptr %35, align 1