annotate test/Transforms/InstCombine/memmove.ll @ 134:3a76565eade5 LLVM5.0.1

update 5.0.1
author mir3636
date Sat, 17 Feb 2018 09:57:20 +0900
parents 803732b1fca8
children c2174574ed3a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 ; This test makes sure that memmove instructions are properly eliminated.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 ;
121
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
3 ; RUN: opt < %s -instcombine -S | FileCheck %s
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 @S = internal constant [33 x i8] c"panic: restorelist inconsistency\00" ; <[33 x i8]*> [#uses=1]
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 @h = constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=1]
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 @hel = constant [4 x i8] c"hel\00" ; <[4 x i8]*> [#uses=1]
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 @hello_u = constant [8 x i8] c"hello_u\00" ; <[8 x i8]*> [#uses=1]
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 define void @test1(i8* %A, i8* %B, i32 %N) {
121
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
11 ;; CHECK-LABEL: test1
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
12 ;; CHECK-NEXT: ret void
134
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
13 call void @llvm.memmove.p0i8.p0i8.i32(i8* %A, i8* %B, i32 0, i1 false)
121
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
14 ret void
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 define void @test2(i8* %A, i32 %N) {
121
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
18 ;; dest can't alias source since we can't write to source!
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
19 ;; CHECK-LABEL: test2
134
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
20 ;; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 %A, i8* align 16 getelementptr inbounds ([33 x i8], [33 x i8]* @S, i{{32|64}} 0, i{{32|64}} 0), i32 %N, i1 false)
121
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
21 ;; CHECK-NEXT: ret void
134
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
22 call void @llvm.memmove.p0i8.p0i8.i32(i8* %A, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @S, i32 0, i32 0), i32 %N, i1 false)
121
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
23 ret void
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
121
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
26 define i32 @test3([1024 x i8]* %target) { ; arg: [1024 x i8]*> [#uses=1]
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
27 ;; CHECK-LABEL: test3
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
28 ;; CHECK-NEXT: [[P1:%[^\s]+]] = bitcast [1024 x i8]* %target to i16*
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
29 ;; CHECK-NEXT: store i16 104, i16* [[P1]], align 2
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
30 ;; CHECK-NEXT: [[P2:%[^\s]+]] = bitcast [1024 x i8]* %target to i32*
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
31 ;; CHECK-NEXT: store i32 7103848, i32* [[P2]], align 4
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
32 ;; CHECK-NEXT: [[P3:%[^\s]+]] = bitcast [1024 x i8]* %target to i64*
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
33 ;; CHECK-NEXT: store i64 33037504440198504, i64* [[P3]], align 8
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
34 ;; CHECK-NEXT: ret i32 0
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
35 %h_p = getelementptr [2 x i8], [2 x i8]* @h, i32 0, i32 0 ; <i8*> [#uses=1]
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
36 %hel_p = getelementptr [4 x i8], [4 x i8]* @hel, i32 0, i32 0 ; <i8*> [#uses=1]
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
37 %hello_u_p = getelementptr [8 x i8], [8 x i8]* @hello_u, i32 0, i32 0 ; <i8*> [#uses=1]
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
38 %target_p = getelementptr [1024 x i8], [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=3]
134
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
39 call void @llvm.memmove.p0i8.p0i8.i32(i8* align 2 %target_p, i8* align 2 %h_p, i32 2, i1 false)
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
40 call void @llvm.memmove.p0i8.p0i8.i32(i8* align 4 %target_p, i8* align 4 %hel_p, i32 4, i1 false)
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
41 call void @llvm.memmove.p0i8.p0i8.i32(i8* align 8 %target_p, i8* align 8 %hello_u_p, i32 8, i1 false)
121
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
42 ret i32 0
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 ; PR2370
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 define void @test4(i8* %a) {
121
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
47 ;; CHECK-LABEL: test4
803732b1fca8 LLVM 5.0
kono
parents: 95
diff changeset
48 ;; CHECK-NEXT: ret void
134
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
49 tail call void @llvm.memmove.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i1 false)
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 ret void
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 }
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
134
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
53 declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1) argmemonly nounwind