diff options
author | Daniel Berlin <dberlin@dberlin.org> | 2017-02-15 23:16:20 +0000 |
---|---|---|
committer | Daniel Berlin <dberlin@dberlin.org> | 2017-02-15 23:16:20 +0000 |
commit | d17bca97a51bcf4b75c622af1b85f51e421b8616 (patch) | |
tree | 869efbfd003828a4eb54f105217a1dbf0344d104 /test/CodeGen/Generic | |
parent | 644ed4d33fbe2219bf0f039f09965f77ab7bca5b (diff) |
Implement intrinsic mangling for literal struct types.
Fixes PR 31921
Summary:
Predicateinfo requires an ugly workaround to try to avoid literal
struct types due to the intrinsic mangling not being implemented.
This workaround actually does not work in all cases (you can hit the
assert by bootstrapping with -print-predicateinfo), and can't be made
to work without DFS'ing the type (IE copying getMangledStr and using a
version that detects if it would crash).
Rather than do that, i just implemented the mangling. It seems
simple, since they are unified structurally.
Looking at the overloaded-mangling testcase we have, it actually turns
out the gc intrinsics will *also* crash if you try to use a literal
struct. Thus, the testcase added fails before this patch, and works
after, without needing to resort to predicateinfo.
Reviewers: chandlerc, davide
Subscribers: llvm-commits, sanjoy
Differential Revision: https://reviews.llvm.org/D29925
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295253 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Generic')
-rw-r--r-- | test/CodeGen/Generic/overloaded-intrinsic-name.ll | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/test/CodeGen/Generic/overloaded-intrinsic-name.ll b/test/CodeGen/Generic/overloaded-intrinsic-name.ll index 65fc9c1184c..60068adc5da 100644 --- a/test/CodeGen/Generic/overloaded-intrinsic-name.ll +++ b/test/CodeGen/Generic/overloaded-intrinsic-name.ll @@ -44,14 +44,41 @@ define <3 x i32>* @test_vAny(<3 x i32>* %v) gc "statepoint-example" { ; struct define %struct.test* @test_struct(%struct.test* %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, %struct.test* %v) - %v-new = call %struct.test* @llvm.experimental.gc.relocate.p0struct.test(token %tok, i32 7, i32 7) + %v-new = call %struct.test* @llvm.experimental.gc.relocate.p0s_struct.tests(token %tok, i32 7, i32 7) ret %struct.test* %v-new } +; literal struct with nested literal struct +define {i64, i64, {i64} }* @test_literal_struct({i64, i64, {i64}}* %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, {i64, i64, {i64}} *%v) + %v-new = call {i64, i64, {i64}}* @llvm.experimental.gc.relocate.p0sl_i64i64sl_i64ss.test(token %tok, i32 7, i32 7) + ret {i64, i64, {i64}}* %v-new +} +; struct with a horrible name, broken when structs were unprefixed +%i32 = type { i32 } + +define %i32* @test_i32_struct(%i32* %v) gc "statepoint-example" { +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, %i32* %v) + %v-new = call %i32* @llvm.experimental.gc.relocate.p0s_i32s(token %tok, i32 7, i32 7) + ret %i32* %v-new +} +; completely broken intrinsic naming due to needing remangling. Just use random naming to test + +define %i32* @test_broken_names(%i32* %v) gc "statepoint-example" { +entry: + %tok = call 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, %i32* %v) + %v-new = call %i32* @llvm.experimental.gc.relocate.beefdead(token %tok, i32 7, i32 7) + ret %i32* %v-new +} declare zeroext i1 @return_i1() declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...) declare i32* @llvm.experimental.gc.relocate.p0i32(token, i32, i32) declare float* @llvm.experimental.gc.relocate.p0f32(token, i32, i32) declare [3 x i32]* @llvm.experimental.gc.relocate.p0a3i32(token, i32, i32) declare <3 x i32>* @llvm.experimental.gc.relocate.p0v3i32(token, i32, i32) -declare %struct.test* @llvm.experimental.gc.relocate.p0struct.test(token, i32, i32) +declare %struct.test* @llvm.experimental.gc.relocate.p0s_struct.tests(token, i32, i32) +declare {i64, i64, {i64}}* @llvm.experimental.gc.relocate.p0sl_i64i64sl_i64ss.test(token, i32, i32) +declare %i32* @llvm.experimental.gc.relocate.p0s_i32s(token, i32, i32) +declare %i32* @llvm.experimental.gc.relocate.beefdead(token, i32, i32) +declare token @llvm.experimental.gc.statepoint.deadbeef(i64, i32, i1 ()*, i32, i32, ...) |