Revert r245635, "[InstCombine] Transform A & (L - 1) u< L --> L != 0"
[oota-llvm.git] / test / Transforms / InstCombine / gc.relocate.ll
1 ; RUN: opt < %s -instcombine -S | FileCheck %s
2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
3
4 ; Uses InstCombine with DataLayout to propagate dereferenceable
5 ; attribute via gc.relocate: if the derived ptr is dereferenceable(N),
6 ; then the return attribute of gc.relocate is dereferenceable(N).
7
8 declare zeroext i1 @return_i1()
9 declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
10 declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32)
11
12 define i32 addrspace(1)* @deref(i32 addrspace(1)* dereferenceable(8) %dparam) gc "statepoint-example" {
13 ; Checks that a dereferenceabler pointer
14 ; CHECK-LABEL: @deref
15 ; CHECK: call dereferenceable(8)
16 entry:
17     %load = load i32, i32 addrspace(1)* %dparam
18     %tok = tail call i32 (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* %dparam)
19     %relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %tok,  i32 7, i32 7)
20     ret i32 addrspace(1)* %relocate
21 }