1 ; RUN: opt -verify -S < %s
3 ; Tests the name mangling performed by the codepath following
4 ; getMangledTypeStr(). Only tests that code with the various manglings
5 ; run fine: doesn't actually test the mangling with the type of the
6 ; arguments. Meant to serve as an example-document on how the user
7 ; should do name manglings.
9 ; Exercise the most general case, llvm_anyptr_type, using gc.relocate
10 ; and gc.statepoint. Note that it has nothing to do with gc.*
11 ; functions specifically: any function that accepts llvm_anyptr_type
12 ; will serve the purpose.
14 ; function and integer
15 define i32* @test_iAny(i32* %v) gc "statepoint-example" {
16 %tok = 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* %v)
17 %v-new = call i32* @llvm.experimental.gc.relocate.p0i32(i32 %tok, i32 7, i32 7)
22 define float* @test_fAny(float* %v) gc "statepoint-example" {
23 %tok = 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, float* %v)
24 %v-new = call float* @llvm.experimental.gc.relocate.p0f32(i32 %tok, i32 7, i32 7)
29 define [3 x i32]* @test_aAny([3 x i32]* %v) gc "statepoint-example" {
30 %tok = 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, [3 x i32]* %v)
31 %v-new = call [3 x i32]* @llvm.experimental.gc.relocate.p0a3i32(i32 %tok, i32 7, i32 7)
36 define <3 x i32>* @test_vAny(<3 x i32>* %v) gc "statepoint-example" {
37 %tok = 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, <3 x i32>* %v)
38 %v-new = call <3 x i32>* @llvm.experimental.gc.relocate.p0v3i32(i32 %tok, i32 7, i32 7)
42 %struct.test = type { i32, i1 }
45 define %struct.test* @test_struct(%struct.test* %v) gc "statepoint-example" {
46 %tok = 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, %struct.test* %v)
47 %v-new = call %struct.test* @llvm.experimental.gc.relocate.p0struct.test(i32 %tok, i32 7, i32 7)
48 ret %struct.test* %v-new
51 declare zeroext i1 @return_i1()
52 declare i32 @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
53 declare i32* @llvm.experimental.gc.relocate.p0i32(i32, i32, i32)
54 declare float* @llvm.experimental.gc.relocate.p0f32(i32, i32, i32)
55 declare [3 x i32]* @llvm.experimental.gc.relocate.p0a3i32(i32, i32, i32)
56 declare <3 x i32>* @llvm.experimental.gc.relocate.p0v3i32(i32, i32, i32)
57 declare %struct.test* @llvm.experimental.gc.relocate.p0struct.test(i32, i32, i32)