diff options
| author | Philip Reames <listmail@philipreames.com> | 2015-05-12 22:19:52 +0000 |
|---|---|---|
| committer | Philip Reames <listmail@philipreames.com> | 2015-05-12 22:19:52 +0000 |
| commit | 311f7106547106fd23022f082762d83c2886db74 (patch) | |
| tree | 2b78c4f9bc93305633a5bae5332fc54732506baf /llvm/test/Transforms/RewriteStatepointsForGC/live-vector.ll | |
| parent | dd90dc8aa95dbcd59a6dbfa1d192047c9d996008 (diff) | |
| download | bcm5719-llvm-311f7106547106fd23022f082762d83c2886db74.tar.gz bcm5719-llvm-311f7106547106fd23022f082762d83c2886db74.zip | |
[RewriteStatepointsForGC] Extend base pointer to handle more cases w/vectors
When relocating a pointer, we need to determine a base pointer for the derived pointer being relocated. We have limited support for handling a pointer extracted from a vector; the current code only handled the case where the entire vector was known to contain base pointers. This patch extends the reasoning to handle chains of insertelements where the indices are constants. This case turns out to be fairly common in vectorized code. We can now handle vectors which contains mixtures of base and derived pointers provided the insertelements use constant indices.
Note that this doesn't solve the general problem. To handle variable indexed insertelements, we'd need to scalarize and introduce conditional branching based on the index. Alternatively, we could eagerly scalarize, but the code structure doesn't currently make either fix easy. The patch also doesn't handle shufflevector or other vector manipulation for much the same reasons. I plan to defer this work until I have a motivating test case.
Differential Revision: http://reviews.llvm.org/D9676
llvm-svn: 237200
Diffstat (limited to 'llvm/test/Transforms/RewriteStatepointsForGC/live-vector.ll')
| -rw-r--r-- | llvm/test/Transforms/RewriteStatepointsForGC/live-vector.ll | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/live-vector.ll b/llvm/test/Transforms/RewriteStatepointsForGC/live-vector.ll index b827133489b..be666d67256 100644 --- a/llvm/test/Transforms/RewriteStatepointsForGC/live-vector.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/live-vector.ll @@ -91,6 +91,31 @@ exceptional_return: ; preds = %entry ret <2 x i64 addrspace(1)*> %obj } +; Can we handle an insert element with a constant offset? This effectively +; tests both the equal and inequal case since we have to relocate both indices +; in the vector. +define <2 x i64 addrspace(1)*> @test5(i64 addrspace(1)* %p) + gc "statepoint-example" { +; CHECK-LABEL: test5 +; CHECK: insertelement +; CHECK-NEXT: extractelement +; CHECK-NEXT: extractelement +; CHECK-NEXT: gc.statepoint +; CHECK-NEXT: gc.relocate +; CHECK-NEXT: bitcast +; CHECK-NEXT: gc.relocate +; CHECK-NEXT: bitcast +; CHECK-NEXT: gc.relocate +; CHECK-NEXT: bitcast +; CHECK-NEXT: insertelement +; CHECK-NEXT: insertelement +; CHECK-NEXT: ret <2 x i64 addrspace(1)*> %7 +entry: + %vec = insertelement <2 x i64 addrspace(1)*> undef, i64 addrspace(1)* %p, i32 0 + %safepoint_token = call i32 (void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()* @do_safepoint, i32 0, i32 0, i32 0, i32 0) + ret <2 x i64 addrspace(1)*> %vec +} + declare void @do_safepoint() declare i32 @llvm.experimental.gc.statepoint.p0f_isVoidf(void ()*, i32, i32, ...) |

