blob: 1ec3fefc56568e1d4fc51f4b3db7258c53f9f211 [file] [log] [blame]
Ramkumar Ramachandra8378ac32015-02-06 01:46:42 +00001; RUN: opt -print-memderefs -analyze -S <%s | FileCheck %s
2
3; Uses the print-deref (+ analyze to print) pass to run
4; isDereferenceablePointer() on many load instruction operands
5
6declare zeroext i1 @return_i1()
7
8@globalstr = global [6 x i8] c"hello\00"
9
10define void @test(i32 addrspace(1)* byval %dparam) {
11; CHECK: The following are dereferenceable:
12; CHECK: %globalptr
13; CHECK: %alloca
14; CHECK: %dparam
15; We haven't yet taught it to look through relocations
16; CHECK-NOT: %relocate
17; CHECK-NOT: %nparam
18entry:
19 %globalptr = getelementptr inbounds [6 x i8]* @globalstr, i32 0, i32 0
20 %load1 = load i8* %globalptr
21 %alloca = alloca i1
22 %load2 = load i1* %alloca
23 %load3 = load i32 addrspace(1)* %dparam
24 %tok = tail call i32 (i1 ()*, i32, i32, ...)* @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 addrspace(1)* %dparam)
25 %relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %tok, i32 4, i32 4)
26 %load4 = load i32 addrspace(1)* %relocate
27 %nparam = getelementptr i32 addrspace(1)* %dparam, i32 5
28 %load5 = load i32 addrspace(1)* %nparam
29 ret void
30}
31
32declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()*, i32, i32, ...)
33declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32)