diff options
author | Anna Thomas <anna@azul.com> | 2016-08-29 15:41:59 +0000 |
---|---|---|
committer | Anna Thomas <anna@azul.com> | 2016-08-29 15:41:59 +0000 |
commit | 2bc129c5fda5ccd3c0f6a4c169e998c9208c895e (patch) | |
tree | 4bcaf1a819e13cbf35b586c7e9237d8c1b9110bf /llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll | |
parent | 6e711c33b468f9802e515d42017552a85d82e5a9 (diff) | |
download | bcm5719-llvm-2bc129c5fda5ccd3c0f6a4c169e998c9208c895e.tar.gz bcm5719-llvm-2bc129c5fda5ccd3c0f6a4c169e998c9208c895e.zip |
[StatepointsForGC] Rematerialize in the presence of PHIs
Summary:
While walking the use chain for identifying rematerializable values in RS4GC,
add the case where the current value and base value are the same PHI nodes.
This will aid rematerialization of geps and casts instead of relocating.
Reviewers: sanjoy, reames, igor
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D23920
llvm-svn: 279975
Diffstat (limited to 'llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll')
-rw-r--r-- | llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll b/llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll index c4ec2ce5bf7..84eb5122798 100644 --- a/llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/rematerialize-derived-pointers.ll @@ -259,3 +259,40 @@ entry: call void @use_obj32(i32 addrspace(1)* %ptr.gep11) ret void } + + +declare i32 addrspace(1)* @new_instance() nounwind "gc-leaf-function" + +; remat the gep in presence of base pointer which is a phi node. +; FIXME: We should remove the extra basephi.base as well. +define void @contains_basephi(i1 %cond) gc "statepoint-example" { +; CHECK-LABEL: contains_basephi +entry: + %base1 = call i32 addrspace(1)* @new_instance() + %base2 = call i32 addrspace(1)* @new_instance() + br i1 %cond, label %here, label %there + +here: + br label %merge + +there: + br label %merge + +merge: + ; CHECK: %basephi.base = phi i32 addrspace(1)* [ %base1, %here ], [ %base2, %there ], !is_base_value !0 + ; CHECK: %basephi = phi i32 addrspace(1)* [ %base1, %here ], [ %base2, %there ] + ; CHECK: %ptr.gep = getelementptr i32, i32 addrspace(1)* %basephi, i32 15 + ; CHECK: %statepoint_token = call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint + ; CHECK: %basephi.base.relocated = call coldcc i8 addrspace(1)* @llvm.experimental.gc.relocate.p1i8(token %statepoint_token, i32 7, i32 7) ; (%basephi.base, %basephi.base) + ; CHECK: %basephi.base.relocated.casted = bitcast i8 addrspace(1)* %basephi.base.relocated to i32 addrspace(1)* + ; CHECK: %ptr.gep.remat = getelementptr i32, i32 addrspace(1)* %basephi, i32 15 + ; CHECK: call void @use_obj32(i32 addrspace(1)* %ptr.gep.remat) + + + + %basephi = phi i32 addrspace(1)* [ %base1, %here ], [ %base2, %there ] + %ptr.gep = getelementptr i32, i32 addrspace(1)* %basephi, i32 15 + call void @do_safepoint() ["deopt"() ] + call void @use_obj32(i32 addrspace(1)* %ptr.gep) + ret void +} |