memrchr.ll
1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instcombine -S | FileCheck %s
declare i8* @memrchr(i8*, i32, i32)
define i8* @test1(i8* %str, i32 %c, i32 %n) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* [[STR:%.*]], i32 [[C:%.*]], i32 [[N:%.*]])
; CHECK-NEXT: ret i8* [[RET]]
;
%ret = call i8* @memrchr(i8* %str, i32 %c, i32 %n)
ret i8* %ret
}
define i8* @test2(i8* %str, i32 %c, i32 %n) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* nonnull [[STR:%.*]], i32 [[C:%.*]], i32 [[N:%.*]])
; CHECK-NEXT: ret i8* [[RET]]
;
%ret = call i8* @memrchr(i8* nonnull %str, i32 %c, i32 %n)
ret i8* %ret
}
define i8* @test3(i8* %str, i32 %c) {
; CHECK-LABEL: @test3(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* [[STR:%.*]], i32 [[C:%.*]], i32 5)
; CHECK-NEXT: ret i8* [[RET]]
;
%ret = call i8* @memrchr(i8* %str, i32 %c, i32 5)
ret i8* %ret
}
define i8* @test4(i8* %str, i32 %c) "null-pointer-is-valid"="true" {
; CHECK-LABEL: @test4(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* [[STR:%.*]], i32 [[C:%.*]], i32 5)
; CHECK-NEXT: ret i8* [[RET]]
;
%ret = call i8* @memrchr(i8* %str, i32 %c, i32 5)
ret i8* %ret
}
define i8* @test5(i8* %str, i32 %c) {
; CHECK-LABEL: @test5(
; CHECK-NEXT: [[RET:%.*]] = call i8* @memrchr(i8* [[STR:%.*]], i32 [[C:%.*]], i32 0)
; CHECK-NEXT: ret i8* [[RET]]
;
%ret = call i8* @memrchr(i8* %str, i32 %c, i32 0)
ret i8* %ret
}