Home | History | Annotate | Download | only in ValueTracking
      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 target datalayout = "e"
      7 
      8 declare zeroext i1 @return_i1()
      9 
     10 @globalstr = global [6 x i8] c"hello\00"
     11 
     12 define void @test(i32 addrspace(1)* dereferenceable(8) %dparam) gc "statepoint-example" {
     13 ; CHECK: The following are dereferenceable:
     14 ; CHECK: %globalptr
     15 ; CHECK: %alloca
     16 ; CHECK: %dparam
     17 ; CHECK: %relocate
     18 ; CHECK-NOT: %nparam
     19 entry:
     20     %globalptr = getelementptr inbounds [6 x i8], [6 x i8]* @globalstr, i32 0, i32 0
     21     %load1 = load i8, i8* %globalptr
     22     %alloca = alloca i1
     23     %load2 = load i1, i1* %alloca
     24     %load3 = load i32, i32 addrspace(1)* %dparam
     25     %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)
     26     %relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %tok, i32 4, i32 4)
     27     %load4 = load i32, i32 addrspace(1)* %relocate
     28     %nparam = getelementptr i32, i32 addrspace(1)* %dparam, i32 5
     29     %load5 = load i32, i32 addrspace(1)* %nparam
     30     ret void
     31 }
     32 
     33 declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()*, i32, i32, ...)
     34 declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32)
     35