annotate test/Transforms/InstCombine/memcpy-1.ll @ 121:803732b1fca8

LLVM 5.0
author kono
date Fri, 27 Oct 2017 17:07:41 +0900
parents 95c75e76d11b
children 3a76565eade5
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 ; Test that the memcpy library call simplifier works correctly.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 ;
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 ; RUN: opt < %s -instcombine -S | FileCheck %s
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 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:128:128"
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 declare i8* @memcpy(i8*, i8*, i32)
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 ; Check memcpy(mem1, mem2, size) -> llvm.memcpy(mem1, mem2, size, 1).
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 define i8* @test_simplify1(i8* %mem1, i8* %mem2, i32 %size) {
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 ; CHECK-LABEL: @test_simplify1(
121
803732b1fca8 LLVM 5.0
kono
parents: 0
diff changeset
13 ; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %mem1, i8* %mem2, i32 %size, i32 1, i1 false)
803732b1fca8 LLVM 5.0
kono
parents: 0
diff changeset
14 ; CHECK-NEXT: ret i8* %mem1
803732b1fca8 LLVM 5.0
kono
parents: 0
diff changeset
15 ;
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 %ret = call i8* @memcpy(i8* %mem1, i8* %mem2, i32 %size)
121
803732b1fca8 LLVM 5.0
kono
parents: 0
diff changeset
17 ret i8* %ret
803732b1fca8 LLVM 5.0
kono
parents: 0
diff changeset
18 }
803732b1fca8 LLVM 5.0
kono
parents: 0
diff changeset
19
803732b1fca8 LLVM 5.0
kono
parents: 0
diff changeset
20 ; Verify that the strictfp attr doesn't block this optimization.
803732b1fca8 LLVM 5.0
kono
parents: 0
diff changeset
21
803732b1fca8 LLVM 5.0
kono
parents: 0
diff changeset
22 define i8* @test_simplify2(i8* %mem1, i8* %mem2, i32 %size) {
803732b1fca8 LLVM 5.0
kono
parents: 0
diff changeset
23 ; CHECK-LABEL: @test_simplify2(
803732b1fca8 LLVM 5.0
kono
parents: 0
diff changeset
24 %ret = call i8* @memcpy(i8* %mem1, i8* %mem2, i32 %size) strictfp
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 ; CHECK: call void @llvm.memcpy
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 ret i8* %ret
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 ; CHECK: ret i8* %mem1
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 }