1 ; RUN: opt < %s -datalayout -instcombine -S | FileCheck %s
3 ; Uses InstCombine with DataLayout to propagate dereferenceable
4 ; attribute via gc.relocate: if the derived ptr is dereferenceable(N),
5 ; then the return attribute of gc.relocate is dereferenceable(N).
7 declare zeroext i1 @return_i1()
8 declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i1 ()*, i32, i32, ...)
9 declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32)
11 define i32 addrspace(1)* @deref(i32 addrspace(1)* dereferenceable(8) %dparam) {
12 ; Checks that a dereferenceabler pointer
14 ; CHECK: call dereferenceable(8)
16 %load = load i32, i32 addrspace(1)* %dparam
17 %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)
18 %relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %tok, i32 4, i32 4)
19 ret i32 addrspace(1)* %relocate