1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
Fedor Sergeev 9146e8f676 [PM] port Rewrite Statepoints For GC to the new pass manager.
Summary:
The port is nearly straightforward.
The only complication is related to the analyses handling,
since one of the analyses used in this module pass is domtree,
which is a function analysis. That requires asking for the results
of each function and disallows a single interface for run-on-module
pass action.

Decided to copy-paste the main body of this pass.
Most of its code is requesting analyses anyway, so not that much
of a copy-paste.

The rest of the code movement is to transform all the implementation
helper functions like stripNonValidData into non-member statics.

Extended all the related LLVM tests with new-pass-manager use.
No failures.

Reviewers: sanjoy, anna, reames

Reviewed By: anna

Subscribers: skatkov, llvm-commits

Differential Revision: https://reviews.llvm.org/D41162

llvm-svn: 320796
2017-12-15 09:32:11 +00:00

37 lines
1.5 KiB
LLVM

; RUN: opt < %s -rewrite-statepoints-for-gc -spp-print-base-pointers -S 2>&1 | FileCheck %s
; RUN: opt < %s -passes=rewrite-statepoints-for-gc -spp-print-base-pointers -S 2>&1 | FileCheck %s
declare i1 @runtime_value() "gc-leaf-function"
declare void @do_safepoint()
define void @select_of_phi(i64 addrspace(1)* %base_obj_x, i64 addrspace(1)* %base_obj_y) gc "statepoint-example" {
entry:
br label %loop
loop: ; preds = %merge, %entry
%current_x = phi i64 addrspace(1)* [ %base_obj_x, %entry ], [ %next_x, %merge ]
%current_y = phi i64 addrspace(1)* [ %base_obj_y, %entry ], [ %next_y, %merge ]
%current = phi i64 addrspace(1)* [ null, %entry ], [ %next, %merge ]
%condition = call i1 @runtime_value()
%next_x = getelementptr i64, i64 addrspace(1)* %current_x, i32 1
%next_y = getelementptr i64, i64 addrspace(1)* %current_y, i32 1
br i1 %condition, label %true, label %false
true: ; preds = %loop
br label %merge
false: ; preds = %loop
br label %merge
merge: ; preds = %false, %true
%next = phi i64 addrspace(1)* [ %next_x, %true ], [ %next_y, %false ]
call void @do_safepoint() [ "deopt"(i32 0, i32 -1, i32 0, i32 0, i32 0) ]
br label %loop
}
; CHECK: Base Pairs (w/o Relocation):
; CHECK-DAG: derived %next base %next.base
; CHECK-DAG: derived %next_x base %base_obj_x
; CHECK-DAG: derived %next_y base %base_obj_y