2015-03-05 02:43:29 +08:00
|
|
|
; RUN: opt < %s -instcombine -S | FileCheck %s
|
|
|
|
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"
|
2015-02-15 03:37:54 +08:00
|
|
|
|
|
|
|
; Uses InstCombine with DataLayout to propagate dereferenceable
|
|
|
|
; attribute via gc.relocate: if the derived ptr is dereferenceable(N),
|
|
|
|
; then the return attribute of gc.relocate is dereferenceable(N).
|
|
|
|
|
|
|
|
declare zeroext i1 @return_i1()
|
2015-05-13 07:52:24 +08:00
|
|
|
declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
|
2015-02-15 03:37:54 +08:00
|
|
|
declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32, i32, i32)
|
|
|
|
|
2015-03-27 13:09:33 +08:00
|
|
|
define i32 addrspace(1)* @deref(i32 addrspace(1)* dereferenceable(8) %dparam) gc "statepoint-example" {
|
2015-02-15 03:37:54 +08:00
|
|
|
; Checks that a dereferenceabler pointer
|
|
|
|
; CHECK-LABEL: @deref
|
|
|
|
; CHECK: call dereferenceable(8)
|
|
|
|
entry:
|
2015-02-28 05:17:42 +08:00
|
|
|
%load = load i32, i32 addrspace(1)* %dparam
|
2015-05-13 07:52:24 +08:00
|
|
|
%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)
|
|
|
|
%relocate = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(i32 %tok, i32 7, i32 7)
|
2015-02-15 03:37:54 +08:00
|
|
|
ret i32 addrspace(1)* %relocate
|
2015-03-27 13:09:33 +08:00
|
|
|
}
|