1; RUN: opt < %s -correlated-propagation -S | FileCheck %s 2 3define void @test1(i8* %ptr) { 4; CHECK: test1 5 %A = load i8* %ptr 6 br label %bb 7bb: 8 icmp ne i8* %ptr, null 9; CHECK-NOT: icmp 10 ret void 11} 12 13define void @test2(i8* %ptr) { 14; CHECK: test2 15 store i8 0, i8* %ptr 16 br label %bb 17bb: 18 icmp ne i8* %ptr, null 19; CHECK-NOT: icmp 20 ret void 21} 22 23define void @test3() { 24; CHECK: test3 25 %ptr = alloca i8 26 br label %bb 27bb: 28 icmp ne i8* %ptr, null 29; CHECK-NOT: icmp 30 ret void 31} 32 33declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) 34define void @test4(i8* %dest, i8* %src) { 35; CHECK: test4 36 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1, i32 1, i1 false) 37 br label %bb 38bb: 39 icmp ne i8* %dest, null 40 icmp ne i8* %src, null 41; CHECK-NOT: icmp 42 ret void 43} 44 45declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) 46define void @test5(i8* %dest, i8* %src) { 47; CHECK: test5 48 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1, i32 1, i1 false) 49 br label %bb 50bb: 51 icmp ne i8* %dest, null 52 icmp ne i8* %src, null 53; CHECK-NOT: icmp 54 ret void 55} 56 57declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) 58define void @test6(i8* %dest) { 59; CHECK: test6 60 call void @llvm.memset.p0i8.i32(i8* %dest, i8 255, i32 1, i32 1, i1 false) 61 br label %bb 62bb: 63 icmp ne i8* %dest, null 64; CHECK-NOT: icmp 65 ret void 66} 67 68define void @test7(i8* %dest, i8* %src, i32 %len) { 69; CHECK: test7 70 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 %len, i32 1, i1 false) 71 br label %bb 72bb: 73 %KEEP1 = icmp ne i8* %dest, null 74; CHECK: KEEP1 75 %KEEP2 = icmp ne i8* %src, null 76; CHECK: KEEP2 77 ret void 78} 79 80declare void @llvm.memcpy.p1i8.p1i8.i32(i8 addrspace(1) *, i8 addrspace(1) *, i32, i32, i1) 81define void @test8(i8 addrspace(1) * %dest, i8 addrspace(1) * %src) { 82; CHECK: test8 83 call void @llvm.memcpy.p1i8.p1i8.i32(i8 addrspace(1) * %dest, i8 addrspace(1) * %src, i32 1, i32 1, i1 false) 84 br label %bb 85bb: 86 %KEEP1 = icmp ne i8 addrspace(1) * %dest, null 87; CHECK: KEEP1 88 %KEEP2 = icmp ne i8 addrspace(1) * %src, null 89; CHECK: KEEP2 90 ret void 91} 92 93define void @test9(i8* %dest, i8* %src) { 94; CHECK: test9 95 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 1, i32 1, i1 true) 96 br label %bb 97bb: 98 %KEEP1 = icmp ne i8* %dest, null 99; CHECK: KEEP1 100 %KEEP2 = icmp ne i8* %src, null 101; CHECK: KEEP2 102 ret void 103} 104