Ramkumar Ramachandra | 8378ac3 | 2015-02-06 01:46:42 +0000 | [diff] [blame] | 1 | ; 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 | |
| 6 | declare zeroext i1 @return_i1() |
| 7 | |
| 8 | @globalstr = global [6 x i8] c"hello\00" |
| 9 | |
| 10 | define void @test(i32 addrspace(1)* byval %dparam) { |
| 11 | ; CHECK: The following are dereferenceable: |
| 12 | ; CHECK: %globalptr |
| 13 | ; CHECK: %alloca |
| 14 | ; CHECK: %dparam |
Ramkumar Ramachandra | a7343d6 | 2015-02-09 21:08:03 +0000 | [diff] [blame^] | 15 | ; CHECK: %relocate |
Ramkumar Ramachandra | 8378ac3 | 2015-02-06 01:46:42 +0000 | [diff] [blame] | 16 | ; CHECK-NOT: %nparam |
| 17 | entry: |
| 18 | %globalptr = getelementptr inbounds [6 x i8]* @globalstr, i32 0, i32 0 |
| 19 | %load1 = load i8* %globalptr |
| 20 | %alloca = alloca i1 |
| 21 | %load2 = load i1* %alloca |
| 22 | %load3 = load i32 addrspace(1)* %dparam |
| 23 | %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) |
| 24 | %relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %tok, i32 4, i32 4) |
| 25 | %load4 = load i32 addrspace(1)* %relocate |
| 26 | %nparam = getelementptr i32 addrspace(1)* %dparam, i32 5 |
| 27 | %load5 = load i32 addrspace(1)* %nparam |
| 28 | ret void |
| 29 | } |
| 30 | |
| 31 | declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()*, i32, i32, ...) |
| 32 | declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) |