1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[Tests] Be consistent w/definition of statepoint-example

These tests use the statepoint-example builtin gc which expects address space #1 to the only non-integral address space.  The fact the test used as=0 happened to work, but was caught by a downstream assert.  (Literally years ago, I just happened to notice the XFAIL and fix it now.)
This commit is contained in:
Philip Reames 2020-08-14 20:45:48 -07:00
parent bc40b4f222
commit 6ffb648927
2 changed files with 129 additions and 129 deletions

View File

@ -12,75 +12,75 @@
; will serve the purpose. ; will serve the purpose.
; function and integer ; function and integer
define i32* @test_iAny(i32* %v) gc "statepoint-example" { define i32 addrspace(1)* @test_iAny(i32 addrspace(1)* %v) gc "statepoint-example" {
%tok = call token (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) ["gc-live"(i32* %v)] %tok = call token (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) ["gc-live"(i32 addrspace(1)* %v)]
%v-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 0) %v-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 0)
ret i32* %v-new ret i32 addrspace(1)* %v-new
} }
; float ; float
define float* @test_fAny(float* %v) gc "statepoint-example" { define float addrspace(1)* @test_fAny(float addrspace(1)* %v) gc "statepoint-example" {
%tok = call token (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) ["gc-live"(float* %v)] %tok = call token (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) ["gc-live"(float addrspace(1)* %v)]
%v-new = call float* @llvm.experimental.gc.relocate.p0f32(token %tok, i32 0, i32 0) %v-new = call float addrspace(1)* @llvm.experimental.gc.relocate.p1f32(token %tok, i32 0, i32 0)
ret float* %v-new ret float addrspace(1)* %v-new
} }
; array of integers ; array of integers
define [3 x i32]* @test_aAny([3 x i32]* %v) gc "statepoint-example" { define [3 x i32] addrspace(1)* @test_aAny([3 x i32] addrspace(1)* %v) gc "statepoint-example" {
%tok = call token (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) ["gc-live"([3 x i32]* %v)] %tok = call token (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) ["gc-live"([3 x i32] addrspace(1)* %v)]
%v-new = call [3 x i32]* @llvm.experimental.gc.relocate.p0a3i32(token %tok, i32 0, i32 0) %v-new = call [3 x i32] addrspace(1)* @llvm.experimental.gc.relocate.p1a3i32(token %tok, i32 0, i32 0)
ret [3 x i32]* %v-new ret [3 x i32] addrspace(1)* %v-new
} }
; vector of integers ; vector of integers
define <3 x i32>* @test_vAny(<3 x i32>* %v) gc "statepoint-example" { define <3 x i32> addrspace(1)* @test_vAny(<3 x i32> addrspace(1)* %v) gc "statepoint-example" {
%tok = call token (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) ["gc-live"(<3 x i32>* %v)] %tok = call token (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) ["gc-live"(<3 x i32> addrspace(1)* %v)]
%v-new = call <3 x i32>* @llvm.experimental.gc.relocate.p0v3i32(token %tok, i32 0, i32 0) %v-new = call <3 x i32> addrspace(1)* @llvm.experimental.gc.relocate.p1v3i32(token %tok, i32 0, i32 0)
ret <3 x i32>* %v-new ret <3 x i32> addrspace(1)* %v-new
} }
%struct.test = type { i32, i1 } %struct.test = type { i32, i1 }
; struct ; struct
define %struct.test* @test_struct(%struct.test* %v) gc "statepoint-example" { define %struct.test addrspace(1)* @test_struct(%struct.test addrspace(1)* %v) gc "statepoint-example" {
%tok = call token (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) ["gc-live"(%struct.test* %v)] %tok = call token (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) ["gc-live"(%struct.test addrspace(1)* %v)]
%v-new = call %struct.test* @llvm.experimental.gc.relocate.p0s_struct.tests(token %tok, i32 0, i32 0) %v-new = call %struct.test addrspace(1)* @llvm.experimental.gc.relocate.p1s_struct.tests(token %tok, i32 0, i32 0)
ret %struct.test* %v-new ret %struct.test addrspace(1)* %v-new
} }
; literal struct with nested literal struct ; literal struct with nested literal struct
define {i64, i64, {i64} }* @test_literal_struct({i64, i64, {i64}}* %v) gc "statepoint-example" { define {i64, i64, {i64} } addrspace(1)* @test_literal_struct({i64, i64, {i64}} addrspace(1)* %v) gc "statepoint-example" {
%tok = call token (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) ["gc-live"({i64, i64, {i64}} *%v)] %tok = call token (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) ["gc-live"({i64, i64, {i64}} addrspace(1)* %v)]
%v-new = call {i64, i64, {i64}}* @llvm.experimental.gc.relocate.p0sl_i64i64sl_i64ss.test(token %tok, i32 0, i32 0) %v-new = call {i64, i64, {i64}} addrspace(1)* @llvm.experimental.gc.relocate.p1sl_i64i64sl_i64ss.test(token %tok, i32 0, i32 0)
ret {i64, i64, {i64}}* %v-new ret {i64, i64, {i64}} addrspace(1)* %v-new
} }
; struct with a horrible name, broken when structs were unprefixed ; struct with a horrible name, broken when structs were unprefixed
%i32 = type { i32 } %i32 = type { i32 }
define %i32* @test_i32_struct(%i32* %v) gc "statepoint-example" { define %i32 addrspace(1)* @test_i32_struct(%i32 addrspace(1)* %v) gc "statepoint-example" {
entry: entry:
%tok = call token (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) ["gc-live"(%i32* %v)] %tok = call token (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) ["gc-live"(%i32 addrspace(1)* %v)]
%v-new = call %i32* @llvm.experimental.gc.relocate.p0s_i32s(token %tok, i32 0, i32 0) %v-new = call %i32 addrspace(1)* @llvm.experimental.gc.relocate.p1s_i32s(token %tok, i32 0, i32 0)
ret %i32* %v-new ret %i32 addrspace(1)* %v-new
} }
; completely broken intrinsic naming due to needing remangling. Just use random naming to test ; completely broken intrinsic naming due to needing remangling. Just use random naming to test
define %i32* @test_broken_names(%i32* %v) gc "statepoint-example" { define %i32 addrspace(1)* @test_broken_names(%i32 addrspace(1)* %v) gc "statepoint-example" {
entry: entry:
%tok = call fastcc token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.deadbeef(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live"(%i32* %v)] %tok = call fastcc token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.deadbeef(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0) ["gc-live"(%i32 addrspace(1)* %v)]
; Make sure we do not destroy the calling convention when remangling ; Make sure we do not destroy the calling convention when remangling
; CHECK: fastcc ; CHECK: fastcc
%v-new = call %i32* @llvm.experimental.gc.relocate.beefdead(token %tok, i32 0, i32 0) %v-new = call %i32 addrspace(1)* @llvm.experimental.gc.relocate.beefdead(token %tok, i32 0, i32 0)
ret %i32* %v-new ret %i32 addrspace(1)* %v-new
} }
declare zeroext i1 @return_i1() declare zeroext i1 @return_i1()
declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...) declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
declare i32* @llvm.experimental.gc.relocate.p0i32(token, i32, i32) declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32)
declare float* @llvm.experimental.gc.relocate.p0f32(token, i32, i32) declare float addrspace(1)* @llvm.experimental.gc.relocate.p1f32(token, i32, i32)
declare [3 x i32]* @llvm.experimental.gc.relocate.p0a3i32(token, i32, i32) declare [3 x i32] addrspace(1)* @llvm.experimental.gc.relocate.p1a3i32(token, i32, i32)
declare <3 x i32>* @llvm.experimental.gc.relocate.p0v3i32(token, i32, i32) declare <3 x i32> addrspace(1)* @llvm.experimental.gc.relocate.p1v3i32(token, i32, i32)
declare %struct.test* @llvm.experimental.gc.relocate.p0s_struct.tests(token, i32, i32) declare %struct.test addrspace(1)* @llvm.experimental.gc.relocate.p1s_struct.tests(token, i32, i32)
declare {i64, i64, {i64}}* @llvm.experimental.gc.relocate.p0sl_i64i64sl_i64ss.test(token, i32, i32) declare {i64, i64, {i64}} addrspace(1)* @llvm.experimental.gc.relocate.p1sl_i64i64sl_i64ss.test(token, i32, i32)
declare %i32* @llvm.experimental.gc.relocate.p0s_i32s(token, i32, i32) declare %i32 addrspace(1)* @llvm.experimental.gc.relocate.p1s_i32s(token, i32, i32)
declare %i32* @llvm.experimental.gc.relocate.beefdead(token, i32, i32) declare %i32 addrspace(1)* @llvm.experimental.gc.relocate.beefdead(token, i32, i32)
declare token @llvm.experimental.gc.statepoint.deadbeef(i64, i32, i1 ()*, i32, i32, ...) declare token @llvm.experimental.gc.statepoint.deadbeef(i64, i32, i1 ()*, i32, i32, ...)

View File

@ -5,145 +5,145 @@ target triple = "x86_64-pc-linux-gnu"
declare zeroext i1 @return_i1() declare zeroext i1 @return_i1()
define i32 @test_sor_basic(i32* %base) gc "statepoint-example" { define i32 @test_sor_basic(i32 addrspace(1)* %base) gc "statepoint-example" {
; CHECK: getelementptr i32, i32* %base, i32 15 ; CHECK: getelementptr i32, i32 addrspace(1)* %base, i32 15
; CHECK: getelementptr i32, i32* %base-new, i32 15 ; CHECK: getelementptr i32, i32 addrspace(1)* %base-new, i32 15
entry: entry:
%ptr = getelementptr i32, i32* %base, i32 15 %ptr = getelementptr i32, i32 addrspace(1)* %base, i32 15
%tok = call token (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) ["gc-live"(i32* %base, i32* %ptr)] %tok = call token (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) ["gc-live"(i32 addrspace(1)* %base, i32 addrspace(1)* %ptr)]
%base-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 0) %base-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 0)
%ptr-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 1) %ptr-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 1)
%ret = load i32, i32* %ptr-new %ret = load i32, i32 addrspace(1)* %ptr-new
ret i32 %ret ret i32 %ret
} }
define i32 @test_sor_two_derived(i32* %base) gc "statepoint-example" { define i32 @test_sor_two_derived(i32 addrspace(1)* %base) gc "statepoint-example" {
; CHECK: getelementptr i32, i32* %base, i32 15 ; CHECK: getelementptr i32, i32 addrspace(1)* %base, i32 15
; CHECK: getelementptr i32, i32* %base, i32 12 ; CHECK: getelementptr i32, i32 addrspace(1)* %base, i32 12
; CHECK: getelementptr i32, i32* %base-new, i32 12 ; CHECK: getelementptr i32, i32 addrspace(1)* %base-new, i32 12
; CHECK: getelementptr i32, i32* %base-new, i32 15 ; CHECK: getelementptr i32, i32 addrspace(1)* %base-new, i32 15
entry: entry:
%ptr = getelementptr i32, i32* %base, i32 15 %ptr = getelementptr i32, i32 addrspace(1)* %base, i32 15
%ptr2 = getelementptr i32, i32* %base, i32 12 %ptr2 = getelementptr i32, i32 addrspace(1)* %base, i32 12
%tok = call token (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) ["gc-live"(i32* %base, i32* %ptr, i32* %ptr2)] %tok = call token (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) ["gc-live"(i32 addrspace(1)* %base, i32 addrspace(1)* %ptr, i32 addrspace(1)* %ptr2)]
%base-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 0) %base-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 0)
%ptr-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 1) %ptr-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 1)
%ptr2-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 2) %ptr2-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 2)
%ret = load i32, i32* %ptr-new %ret = load i32, i32 addrspace(1)* %ptr-new
ret i32 %ret ret i32 %ret
} }
define i32 @test_sor_ooo(i32* %base) gc "statepoint-example" { define i32 @test_sor_ooo(i32 addrspace(1)* %base) gc "statepoint-example" {
; CHECK: getelementptr i32, i32* %base, i32 15 ; CHECK: getelementptr i32, i32 addrspace(1)* %base, i32 15
; CHECK: getelementptr i32, i32* %base-new, i32 15 ; CHECK: getelementptr i32, i32 addrspace(1)* %base-new, i32 15
entry: entry:
%ptr = getelementptr i32, i32* %base, i32 15 %ptr = getelementptr i32, i32 addrspace(1)* %base, i32 15
%tok = call token (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) ["gc-live"(i32* %base, i32* %ptr)] %tok = call token (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) ["gc-live"(i32 addrspace(1)* %base, i32 addrspace(1)* %ptr)]
%ptr-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 1) %ptr-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 1)
%base-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 0) %base-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 0)
%ret = load i32, i32* %ptr-new %ret = load i32, i32 addrspace(1)* %ptr-new
ret i32 %ret ret i32 %ret
} }
define i32 @test_sor_gep_smallint([3 x i32]* %base) gc "statepoint-example" { define i32 @test_sor_gep_smallint([3 x i32] addrspace(1)* %base) gc "statepoint-example" {
; CHECK: getelementptr [3 x i32], [3 x i32]* %base, i32 0, i32 2 ; CHECK: getelementptr [3 x i32], [3 x i32] addrspace(1)* %base, i32 0, i32 2
; CHECK: getelementptr [3 x i32], [3 x i32]* %base-new, i32 0, i32 2 ; CHECK: getelementptr [3 x i32], [3 x i32] addrspace(1)* %base-new, i32 0, i32 2
entry: entry:
%ptr = getelementptr [3 x i32], [3 x i32]* %base, i32 0, i32 2 %ptr = getelementptr [3 x i32], [3 x i32] addrspace(1)* %base, i32 0, i32 2
%tok = call token (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) ["gc-live"([3 x i32]* %base, i32* %ptr)] %tok = call token (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) ["gc-live"([3 x i32] addrspace(1)* %base, i32 addrspace(1)* %ptr)]
%base-new = call [3 x i32]* @llvm.experimental.gc.relocate.p0a3i32(token %tok, i32 0, i32 0) %base-new = call [3 x i32] addrspace(1)* @llvm.experimental.gc.relocate.p1a3i32(token %tok, i32 0, i32 0)
%ptr-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 1) %ptr-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 1)
%ret = load i32, i32* %ptr-new %ret = load i32, i32 addrspace(1)* %ptr-new
ret i32 %ret ret i32 %ret
} }
define i32 @test_sor_gep_largeint([3 x i32]* %base) gc "statepoint-example" { define i32 @test_sor_gep_largeint([3 x i32] addrspace(1)* %base) gc "statepoint-example" {
; CHECK: getelementptr [3 x i32], [3 x i32]* %base, i32 0, i32 21 ; CHECK: getelementptr [3 x i32], [3 x i32] addrspace(1)* %base, i32 0, i32 21
; CHECK-NOT: getelementptr [3 x i32], [3 x i32]* %base-new, i32 0, i32 21 ; CHECK-NOT: getelementptr [3 x i32], [3 x i32] addrspace(1)* %base-new, i32 0, i32 21
entry: entry:
%ptr = getelementptr [3 x i32], [3 x i32]* %base, i32 0, i32 21 %ptr = getelementptr [3 x i32], [3 x i32] addrspace(1)* %base, i32 0, i32 21
%tok = call token (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) ["gc-live"([3 x i32]* %base, i32* %ptr)] %tok = call token (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) ["gc-live"([3 x i32] addrspace(1)* %base, i32 addrspace(1)* %ptr)]
%base-new = call [3 x i32]* @llvm.experimental.gc.relocate.p0a3i32(token %tok, i32 0, i32 0) %base-new = call [3 x i32] addrspace(1)* @llvm.experimental.gc.relocate.p1a3i32(token %tok, i32 0, i32 0)
%ptr-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 1) %ptr-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 1)
%ret = load i32, i32* %ptr-new %ret = load i32, i32 addrspace(1)* %ptr-new
ret i32 %ret ret i32 %ret
} }
define i32 @test_sor_noop(i32* %base) gc "statepoint-example" { define i32 @test_sor_noop(i32 addrspace(1)* %base) gc "statepoint-example" {
; CHECK: getelementptr i32, i32* %base, i32 15 ; CHECK: getelementptr i32, i32 addrspace(1)* %base, i32 15
; CHECK: call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 1) ; CHECK: call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 1)
; CHECK: call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 2) ; CHECK: call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 2)
entry: entry:
%ptr = getelementptr i32, i32* %base, i32 15 %ptr = getelementptr i32, i32 addrspace(1)* %base, i32 15
%ptr2 = getelementptr i32, i32* %base, i32 12 %ptr2 = getelementptr i32, i32 addrspace(1)* %base, i32 12
%tok = call token (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) ["gc-live"(i32* %base, i32* %ptr, i32* %ptr2)] %tok = call token (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) ["gc-live"(i32 addrspace(1)* %base, i32 addrspace(1)* %ptr, i32 addrspace(1)* %ptr2)]
%ptr-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 1) %ptr-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 1)
%ptr2-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 2) %ptr2-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 2)
%ret = load i32, i32* %ptr-new %ret = load i32, i32 addrspace(1)* %ptr-new
ret i32 %ret ret i32 %ret
} }
define i32 @test_sor_basic_wrong_order(i32* %base) gc "statepoint-example" { define i32 @test_sor_basic_wrong_order(i32 addrspace(1)* %base) gc "statepoint-example" {
; CHECK-LABEL: @test_sor_basic_wrong_order ; CHECK-LABEL: @test_sor_basic_wrong_order
; Here we have base relocate inserted after derived. Make sure that we don't ; Here we have base relocate inserted after derived. Make sure that we don't
; produce uses of the relocated base pointer before it's definition. ; produce uses of the relocated base pointer before it's definition.
entry: entry:
%ptr = getelementptr i32, i32* %base, i32 15 %ptr = getelementptr i32, i32 addrspace(1)* %base, i32 15
; CHECK: getelementptr i32, i32* %base, i32 15 ; CHECK: getelementptr i32, i32 addrspace(1)* %base, i32 15
%tok = call token (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) ["gc-live"(i32* %base, i32* %ptr)] %tok = call token (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) ["gc-live"(i32 addrspace(1)* %base, i32 addrspace(1)* %ptr)]
%ptr-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 1) %ptr-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 1)
%base-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 0) %base-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 0)
; CHECK: %base-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 0) ; CHECK: %base-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 0)
; CHECK-NEXT: getelementptr i32, i32* %base-new, i32 15 ; CHECK-NEXT: getelementptr i32, i32 addrspace(1)* %base-new, i32 15
%ret = load i32, i32* %ptr-new %ret = load i32, i32 addrspace(1)* %ptr-new
ret i32 %ret ret i32 %ret
} }
define i32 @test_sor_noop_cross_bb(i1 %external-cond, i32* %base) gc "statepoint-example" { define i32 @test_sor_noop_cross_bb(i1 %external-cond, i32 addrspace(1)* %base) gc "statepoint-example" {
; CHECK-LABEL: @test_sor_noop_cross_bb ; CHECK-LABEL: @test_sor_noop_cross_bb
; Here base relocate doesn't dominate derived relocate. Make sure that we don't ; Here base relocate doesn't dominate derived relocate. Make sure that we don't
; produce undefined use of the relocated base pointer. ; produce undefined use of the relocated base pointer.
entry: entry:
%ptr = getelementptr i32, i32* %base, i32 15 %ptr = getelementptr i32, i32 addrspace(1)* %base, i32 15
; CHECK: getelementptr i32, i32* %base, i32 15 ; CHECK: getelementptr i32, i32 addrspace(1)* %base, i32 15
%tok = call token (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) ["gc-live"(i32* %base, i32* %ptr)] %tok = call token (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) ["gc-live"(i32 addrspace(1)* %base, i32 addrspace(1)* %ptr)]
br i1 %external-cond, label %left, label %right br i1 %external-cond, label %left, label %right
left: left:
%ptr-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 1) %ptr-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 1)
; CHECK: call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 1) ; CHECK: call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 1)
%ret-new = load i32, i32* %ptr-new %ret-new = load i32, i32 addrspace(1)* %ptr-new
ret i32 %ret-new ret i32 %ret-new
right: right:
%ptr-base = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 0) %ptr-base = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 0)
; CHECK: call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 0) ; CHECK: call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 0)
%ret-base = load i32, i32* %ptr-base %ret-base = load i32, i32 addrspace(1)* %ptr-base
ret i32 %ret-base ret i32 %ret-base
} }
define i32 @test_sor_noop_same_bb(i1 %external-cond, i32* %base) gc "statepoint-example" { define i32 @test_sor_noop_same_bb(i1 %external-cond, i32 addrspace(1)* %base) gc "statepoint-example" {
; CHECK-LABEL: @test_sor_noop_same_bb ; CHECK-LABEL: @test_sor_noop_same_bb
; Here base relocate doesn't dominate derived relocate. Make sure that we don't ; Here base relocate doesn't dominate derived relocate. Make sure that we don't
; produce undefined use of the relocated base pointer. ; produce undefined use of the relocated base pointer.
entry: entry:
%ptr1 = getelementptr i32, i32* %base, i32 15 %ptr1 = getelementptr i32, i32 addrspace(1)* %base, i32 15
; CHECK: getelementptr i32, i32* %base, i32 15 ; CHECK: getelementptr i32, i32 addrspace(1)* %base, i32 15
%ptr2 = getelementptr i32, i32* %base, i32 5 %ptr2 = getelementptr i32, i32 addrspace(1)* %base, i32 5
; CHECK: getelementptr i32, i32* %base, i32 5 ; CHECK: getelementptr i32, i32 addrspace(1)* %base, i32 5
%tok = call token (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) ["gc-live"(i32* %base, i32* %ptr1, i32* %ptr2)] %tok = call token (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) ["gc-live"(i32 addrspace(1)* %base, i32 addrspace(1)* %ptr1, i32 addrspace(1)* %ptr2)]
; CHECK: call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 0) ; CHECK: call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 0)
%ptr2-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 2) %ptr2-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 2)
%ret2-new = load i32, i32* %ptr2-new %ret2-new = load i32, i32 addrspace(1)* %ptr2-new
; CHECK: getelementptr i32, i32* %base-new, i32 5 ; CHECK: getelementptr i32, i32 addrspace(1)* %base-new, i32 5
%ptr1-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 1) %ptr1-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 1)
%ret1-new = load i32, i32* %ptr1-new %ret1-new = load i32, i32 addrspace(1)* %ptr1-new
; CHECK: getelementptr i32, i32* %base-new, i32 15 ; CHECK: getelementptr i32, i32 addrspace(1)* %base-new, i32 15
%base-new = call i32* @llvm.experimental.gc.relocate.p0i32(token %tok, i32 0, i32 0) %base-new = call i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token %tok, i32 0, i32 0)
%ret-new = add i32 %ret2-new, %ret1-new %ret-new = add i32 %ret2-new, %ret1-new
ret i32 %ret-new ret i32 %ret-new
} }
declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...) declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
declare i32* @llvm.experimental.gc.relocate.p0i32(token, i32, i32) declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32)
declare [3 x i32]* @llvm.experimental.gc.relocate.p0a3i32(token, i32, i32) declare [3 x i32] addrspace(1)* @llvm.experimental.gc.relocate.p1a3i32(token, i32, i32)