diff options
author | Ramkumar Ramachandra <artagnon@gmail.com> | 2015-02-06 01:46:42 +0000 |
---|---|---|
committer | Ramkumar Ramachandra <artagnon@gmail.com> | 2015-02-06 01:46:42 +0000 |
commit | 8378ac36845a074fd7a81035ee38175c4ef54c46 (patch) | |
tree | 154ee1bc76cea17ef844f8010825ac85750adc0d /llvm/test/Analysis/ValueTracking | |
parent | 8a3e33945ee1d2961af434dda26de7592fe905f6 (diff) | |
download | bcm5719-llvm-8378ac36845a074fd7a81035ee38175c4ef54c46.tar.gz bcm5719-llvm-8378ac36845a074fd7a81035ee38175c4ef54c46.zip |
Introduce print-memderefs to test isDereferenceablePointer
Since testing the function indirectly is tricky, introduce a direct
print-memderefs pass, in the same spirit as print-memdeps, which prints
dereferenceability information matched by FileCheck.
Differential Revision: http://reviews.llvm.org/D7075
llvm-svn: 228369
Diffstat (limited to 'llvm/test/Analysis/ValueTracking')
-rw-r--r-- | llvm/test/Analysis/ValueTracking/memory-dereferenceable.ll | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/test/Analysis/ValueTracking/memory-dereferenceable.ll b/llvm/test/Analysis/ValueTracking/memory-dereferenceable.ll new file mode 100644 index 00000000000..1ec3fefc565 --- /dev/null +++ b/llvm/test/Analysis/ValueTracking/memory-dereferenceable.ll @@ -0,0 +1,33 @@ +; RUN: opt -print-memderefs -analyze -S <%s | FileCheck %s + +; Uses the print-deref (+ analyze to print) pass to run +; isDereferenceablePointer() on many load instruction operands + +declare zeroext i1 @return_i1() + +@globalstr = global [6 x i8] c"hello\00" + +define void @test(i32 addrspace(1)* byval %dparam) { +; CHECK: The following are dereferenceable: +; CHECK: %globalptr +; CHECK: %alloca +; CHECK: %dparam +; We haven't yet taught it to look through relocations +; CHECK-NOT: %relocate +; CHECK-NOT: %nparam +entry: + %globalptr = getelementptr inbounds [6 x i8]* @globalstr, i32 0, i32 0 + %load1 = load i8* %globalptr + %alloca = alloca i1 + %load2 = load i1* %alloca + %load3 = load i32 addrspace(1)* %dparam + %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) + %relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %tok, i32 4, i32 4) + %load4 = load i32 addrspace(1)* %relocate + %nparam = getelementptr i32 addrspace(1)* %dparam, i32 5 + %load5 = load i32 addrspace(1)* %nparam + ret void +} + +declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()*, i32, i32, ...) +declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32) |