2015-06-03 06:33:37 +08:00
|
|
|
; RUN: opt -S -rewrite-statepoints-for-gc < %s | FileCheck %s
|
|
|
|
|
|
|
|
; CHECK: declare i8 addrspace(1)* @some_function_ret_deref()
|
2016-01-29 08:28:57 +08:00
|
|
|
; CHECK: define i8 addrspace(1)* @test_deref_arg(i8 addrspace(1)* %a)
|
|
|
|
; CHECK: define i8 addrspace(1)* @test_deref_or_null_arg(i8 addrspace(1)* %a)
|
|
|
|
; CHECK: define i8 addrspace(1)* @test_noalias_arg(i8 addrspace(1)* %a)
|
|
|
|
|
|
|
|
declare void @foo()
|
|
|
|
|
|
|
|
declare i8 addrspace(1)* @some_function() "gc-leaf-function"
|
|
|
|
|
|
|
|
declare void @some_function_consumer(i8 addrspace(1)*) "gc-leaf-function"
|
|
|
|
|
|
|
|
declare dereferenceable(4) i8 addrspace(1)* @some_function_ret_deref() "gc-leaf-function"
|
|
|
|
declare noalias i8 addrspace(1)* @some_function_ret_noalias() "gc-leaf-function"
|
2015-06-03 06:33:37 +08:00
|
|
|
|
|
|
|
define i8 addrspace(1)* @test_deref_arg(i8 addrspace(1)* dereferenceable(4) %a) gc "statepoint-example" {
|
|
|
|
entry:
|
2016-01-29 08:28:57 +08:00
|
|
|
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
2015-06-03 06:33:37 +08:00
|
|
|
ret i8 addrspace(1)* %a
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 addrspace(1)* @test_deref_or_null_arg(i8 addrspace(1)* dereferenceable_or_null(4) %a) gc "statepoint-example" {
|
|
|
|
entry:
|
2016-01-29 08:28:57 +08:00
|
|
|
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
|
|
|
ret i8 addrspace(1)* %a
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 addrspace(1)* @test_noalias_arg(i8 addrspace(1)* noalias %a) gc "statepoint-example" {
|
|
|
|
entry:
|
|
|
|
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
2015-06-03 06:33:37 +08:00
|
|
|
ret i8 addrspace(1)* %a
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 addrspace(1)* @test_deref_retval() gc "statepoint-example" {
|
|
|
|
; CHECK-LABEL: @test_deref_retval(
|
2016-01-29 08:28:57 +08:00
|
|
|
; CHECK: %a = call i8 addrspace(1)* @some_function()
|
2015-06-03 06:33:37 +08:00
|
|
|
entry:
|
|
|
|
%a = call dereferenceable(4) i8 addrspace(1)* @some_function()
|
2016-01-29 08:28:57 +08:00
|
|
|
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
2015-06-03 06:33:37 +08:00
|
|
|
ret i8 addrspace(1)* %a
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 addrspace(1)* @test_deref_or_null_retval() gc "statepoint-example" {
|
|
|
|
; CHECK-LABEL: @test_deref_or_null_retval(
|
2016-01-29 08:28:57 +08:00
|
|
|
; CHECK: %a = call i8 addrspace(1)* @some_function()
|
2015-06-03 06:33:37 +08:00
|
|
|
entry:
|
|
|
|
%a = call dereferenceable_or_null(4) i8 addrspace(1)* @some_function()
|
2016-01-29 08:28:57 +08:00
|
|
|
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
|
|
|
ret i8 addrspace(1)* %a
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 addrspace(1)* @test_noalias_retval() gc "statepoint-example" {
|
|
|
|
; CHECK-LABEL: @test_noalias_retval(
|
2015-06-03 06:33:37 +08:00
|
|
|
; CHECK: %a = call i8 addrspace(1)* @some_function()
|
2016-01-29 08:28:57 +08:00
|
|
|
entry:
|
|
|
|
%a = call noalias i8 addrspace(1)* @some_function()
|
|
|
|
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
2015-06-03 06:33:37 +08:00
|
|
|
ret i8 addrspace(1)* %a
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 @test_md(i8 addrspace(1)* %ptr) gc "statepoint-example" {
|
|
|
|
; CHECK-LABEL: @test_md(
|
|
|
|
; CHECK: %tmp = load i8, i8 addrspace(1)* %ptr, !tbaa !0
|
2016-01-29 08:28:57 +08:00
|
|
|
entry:
|
2015-06-03 06:33:37 +08:00
|
|
|
%tmp = load i8, i8 addrspace(1)* %ptr, !tbaa !0
|
2016-01-29 08:28:57 +08:00
|
|
|
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
2015-06-03 06:33:37 +08:00
|
|
|
ret i8 %tmp
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 addrspace(1)* @test_decl_only_attribute(i8 addrspace(1)* %ptr) gc "statepoint-example" {
|
|
|
|
; CHECK-LABEL: @test_decl_only_attribute(
|
|
|
|
; No change here, but the prototype of some_function_ret_deref should have changed.
|
|
|
|
; CHECK: call i8 addrspace(1)* @some_function_ret_deref()
|
2015-10-27 03:06:01 +08:00
|
|
|
entry:
|
2016-01-29 08:28:57 +08:00
|
|
|
%a = call i8 addrspace(1)* @some_function_ret_deref()
|
|
|
|
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
2015-10-27 03:06:01 +08:00
|
|
|
ret i8 addrspace(1)* %a
|
|
|
|
}
|
|
|
|
|
|
|
|
define i8 addrspace(1)* @test_decl_only_noalias(i8 addrspace(1)* %ptr) gc "statepoint-example" {
|
|
|
|
; CHECK-LABEL: @test_decl_only_noalias(
|
|
|
|
; No change here, but the prototype of some_function_ret_noalias should have changed.
|
|
|
|
; CHECK: call i8 addrspace(1)* @some_function_ret_noalias()
|
2016-01-29 08:28:57 +08:00
|
|
|
entry:
|
2015-10-27 03:06:01 +08:00
|
|
|
%a = call i8 addrspace(1)* @some_function_ret_noalias()
|
2016-01-29 08:28:57 +08:00
|
|
|
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
2015-10-27 03:06:01 +08:00
|
|
|
ret i8 addrspace(1)* %a
|
|
|
|
}
|
|
|
|
|
2016-01-29 08:28:57 +08:00
|
|
|
define i8 addrspace(1)* @test_callsite_arg_attribute(i8 addrspace(1)* %ptr) gc "statepoint-example" {
|
|
|
|
; CHECK-LABEL: @test_callsite_arg_attribute(
|
2015-10-27 03:06:01 +08:00
|
|
|
; CHECK: call void @some_function_consumer(i8 addrspace(1)* %ptr)
|
2016-01-29 08:28:57 +08:00
|
|
|
; CHECK: !0 = !{!1, !1, i64 0}
|
|
|
|
; CHECK: !1 = !{!"red", !2}
|
|
|
|
; CHECK: !2 = !{!"blue"}
|
|
|
|
entry:
|
|
|
|
call void @some_function_consumer(i8 addrspace(1)* dereferenceable(4) noalias %ptr)
|
|
|
|
call void @foo() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
|
2015-10-27 03:06:01 +08:00
|
|
|
ret i8 addrspace(1)* %ptr
|
|
|
|
}
|
2015-06-03 06:33:37 +08:00
|
|
|
!0 = !{!1, !1, i64 0, i64 1}
|
|
|
|
!1 = !{!"red", !2}
|
|
|
|
!2 = !{!"blue"}
|