aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/CorrelatedValuePropagation/non-null.ll
blob: 6bb8bb07c45fcb7ce8837d7cfc60fc1813969db8 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
; RUN: opt < %s -correlated-propagation -S | FileCheck %s

define void @test1(i8* %ptr) {
; CHECK: test1
  %A = load i8, i8* %ptr
  br label %bb
bb:
  icmp ne i8* %ptr, null
; CHECK-NOT: icmp
  ret void
}

define void @test2(i8* %ptr) {
; CHECK: test2
  store i8 0, i8* %ptr
  br label %bb
bb:
  icmp ne i8* %ptr, null
; CHECK-NOT: icmp
  ret void
}

define void @test3() {
; CHECK: test3
  %ptr = alloca i8
  br label %bb
bb:
  icmp ne i8* %ptr, null
; CHECK-NOT: icmp
  ret void
}

declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
define void @test4(i8* %dest, i8* %src) {
; CHECK: test4
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1, i32 1, i1 false)
  br label %bb
bb:
  icmp ne i8* %dest, null
  icmp ne i8* %src, null
; CHECK-NOT: icmp
  ret void
}

declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1)
define void @test5(i8* %dest, i8* %src) {
; CHECK: test5
  call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1, i32 1, i1 false)
  br label %bb
bb:
  icmp ne i8* %dest, null
  icmp ne i8* %src, null
; CHECK-NOT: icmp
  ret void
}

declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1)
define void @test6(i8* %dest) {
; CHECK: test6
  call void @llvm.memset.p0i8.i32(i8* %dest, i8 255, i32 1, i32 1, i1 false)
  br label %bb
bb:
  icmp ne i8* %dest, null
; CHECK-NOT: icmp
  ret void
}

define void @test7(i8* %dest, i8* %src, i32 %len) {
; CHECK: test7
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 %len, i32 1, i1 false)
  br label %bb
bb:
  %KEEP1 = icmp ne i8* %dest, null
; CHECK: KEEP1
  %KEEP2 = icmp ne i8* %src, null
; CHECK: KEEP2
  ret void
}

declare void @llvm.memcpy.p1i8.p1i8.i32(i8 addrspace(1) *, i8 addrspace(1) *, i32, i32, i1)
define void @test8(i8 addrspace(1) * %dest, i8 addrspace(1) * %src) {
; CHECK: test8
  call void @llvm.memcpy.p1i8.p1i8.i32(i8 addrspace(1) * %dest, i8 addrspace(1) * %src, i32 1, i32 1, i1 false)
  br label %bb
bb:
  %KEEP1 = icmp ne i8 addrspace(1) * %dest, null
; CHECK: KEEP1
  %KEEP2 = icmp ne i8 addrspace(1) * %src, null
; CHECK: KEEP2
  ret void
}

define void @test9(i8* %dest, i8* %src) {
; CHECK: test9
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1, i32 1, i1 true)
  br label %bb
bb:
  %KEEP1 = icmp ne i8* %dest, null
; CHECK: KEEP1
  %KEEP2 = icmp ne i8* %src, null
; CHECK: KEEP2
  ret void
}