mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-16 10:26:23 +00:00

Currently we consider that each constant has itself as a base value. I.e "base(const) = const". This introduces couple of problems when we are trying to avoid reporting constants in statepoint live sets: 1. When querying "base( phi(const1, const2) )" we will get "phi(const1, const2)" as a base pointer. Since it's not a constant we will record it in a stack map. However on practice we don't want this to happen (constant are never relocated). 2. base( phi(const, gc ptr) ) = phi( const, base(gc ptr) ). This particular case imposes challenge on our runtime - we don't expect to see constant base pointers other than null. This problems can be avoided by treating all constant as if they were derived from null pointer base. I.e in a first case we will not include constant pointer in a stack map at all. In a second case we will get "phi(null, base(gc ptr))" as a base pointer which is a lot more convenient. Differential Revision: http://reviews.llvm.org/D20584 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270993 91177308-0d34-0410-b5e6-96231b3b80d8
21 lines
735 B
LLVM
21 lines
735 B
LLVM
; RUN: opt < %s -rewrite-statepoints-for-gc -spp-print-base-pointers -S 2>&1 | FileCheck %s
|
|
|
|
; CHECK: derived %select base null
|
|
|
|
@global = external addrspace(1) global i8
|
|
|
|
define i8 @test(i1 %cond) gc "statepoint-example" {
|
|
%derived1 = getelementptr i8, i8 addrspace(1)* @global, i64 1
|
|
%derived2 = getelementptr i8, i8 addrspace(1)* @global, i64 2
|
|
%select = select i1 %cond, i8 addrspace(1)* %derived1, i8 addrspace(1)* %derived2
|
|
call void @extern()
|
|
; CHECK-NOT: relocate
|
|
; CHECK: %load = load i8, i8 addrspace(1)* %select
|
|
%load = load i8, i8 addrspace(1)* %select
|
|
ret i8 %load
|
|
}
|
|
|
|
declare void @extern() gc "statepoint-example"
|
|
|
|
declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
|