comparison test/Transforms/InstCombine/annotate-noalias.ll @ 147:c2174574ed3a

LLVM 10
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 16:55:33 +0900
parents
children
comparison
equal deleted inserted replaced
134:3a76565eade5 147:c2174574ed3a
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -instcombine -S < %s | FileCheck %s
3
4
5 declare i8* @memcpy(i8* nocapture, i8* nocapture, i64)
6 declare i8* @strncpy(i8* nocapture, i8* nocapture, i64)
7 declare i8* @strcpy(i8* nocapture, i8* nocapture)
8
9 define i8* @memcpy_const_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) {
10 ; CHECK-LABEL: @memcpy_const_size_noalias(
11 ; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias align 1 dereferenceable(16) [[D:%.*]], i8* noalias align 1 dereferenceable(16) [[S:%.*]], i64 16, i1 false)
12 ; CHECK-NEXT: ret i8* [[D]]
13 ;
14 %call = tail call i8* @memcpy(i8* %d, i8* %s, i64 16)
15 ret i8* %call
16 }
17
18 define i8* @memcpy_const_zero_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) {
19 ; CHECK-LABEL: @memcpy_const_zero_size_noalias(
20 ; CHECK-NEXT: ret i8* [[D:%.*]]
21 ;
22 %call = tail call i8* @memcpy(i8* %d, i8* %s, i64 0)
23 ret i8* %call
24 }
25
26 define i8* @memcpy_nonconst_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s, i64 %n) {
27 ; CHECK-LABEL: @memcpy_nonconst_size_noalias(
28 ; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias align 1 [[D:%.*]], i8* noalias align 1 [[S:%.*]], i64 [[N:%.*]], i1 false)
29 ; CHECK-NEXT: ret i8* [[D]]
30 ;
31 %call = tail call i8* @memcpy(i8* %d, i8* %s, i64 %n)
32 ret i8* %call
33 }
34
35 define i8* @strncpy_const_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) {
36 ; CHECK-LABEL: @strncpy_const_size_noalias(
37 ; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @strncpy(i8* noalias [[D:%.*]], i8* noalias [[S:%.*]], i64 16)
38 ; CHECK-NEXT: ret i8* [[CALL]]
39 ;
40 %call = tail call i8* @strncpy(i8* %d, i8* %s, i64 16)
41 ret i8* %call
42 }
43
44 define i8* @strncpy_const_zero_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) {
45 ; CHECK-LABEL: @strncpy_const_zero_size_noalias(
46 ; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @strncpy(i8* noalias [[D:%.*]], i8* noalias [[S:%.*]], i64 0)
47 ; CHECK-NEXT: ret i8* [[CALL]]
48 ;
49 %call = tail call i8* @strncpy(i8* %d, i8* %s, i64 0)
50 ret i8* %call
51 }
52
53 define i8* @strncpy_nonconst_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s, i64 %n) {
54 ; CHECK-LABEL: @strncpy_nonconst_size_noalias(
55 ; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @strncpy(i8* noalias [[D:%.*]], i8* noalias [[S:%.*]], i64 [[N:%.*]])
56 ; CHECK-NEXT: ret i8* [[CALL]]
57 ;
58 %call = tail call i8* @strncpy(i8* %d, i8* %s, i64 %n)
59 ret i8* %call
60 }
61
62 define i8* @strcpy_const_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) {
63 ; CHECK-LABEL: @strcpy_const_size_noalias(
64 ; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @strcpy(i8* noalias [[D:%.*]], i8* noalias [[S:%.*]])
65 ; CHECK-NEXT: ret i8* [[CALL]]
66 ;
67 %call = tail call i8* @strcpy(i8* %d, i8* %s)
68 ret i8* %call
69 }
70
71 define i8* @strcpy_nonconst_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) {
72 ; CHECK-LABEL: @strcpy_nonconst_size_noalias(
73 ; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @strcpy(i8* noalias [[D:%.*]], i8* noalias [[S:%.*]])
74 ; CHECK-NEXT: ret i8* [[CALL]]
75 ;
76 %call = tail call i8* @strcpy(i8* %d, i8* %s)
77 ret i8* %call
78 }