1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
Daniel Neilson e06efee0cc [RewriteStatepoints] Fix stale parse points
Summary:
RewriteStatepointsForGC collects parse points for further processing.
During the collection if a callsite is found in an unreachable block
(DominatorTree::isReachableFromEntry()) then all unreachable blocks are
removed by removeUnreachableBlocks(). Some of the removed blocks could
have been reachable according to DominatorTree::isReachableFromEntry().
In this case the collected parse points became stale and resulted in a
crash when accessed.

The fix is to unconditionally canonicalize the IR to
removeUnreachableBlocks and then collect the parse points.

The added test crashes with the old version and passes with this patch.

Patch by Yevgeny Rouban!

Reviewed by: Anna

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

llvm-svn: 326748
2018-03-05 22:27:30 +00:00

30 lines
1.1 KiB
LLVM

; RUN: opt -S -rewrite-statepoints-for-gc < %s | FileCheck %s
; RUN: opt -S -passes=rewrite-statepoints-for-gc < %s | FileCheck %s
;
; A test to make sure that we can look through bitcasts of
; vector types when a base pointer is contained in a vector.
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"
target triple = "x86_64-unknown-linux-gnu"
declare i8 addrspace(1)* @foo()
; Function Attrs: uwtable
define i32 @test() gc "statepoint-example" {
; CHECK-LABEL: @test
entry:
; CHECK-LABEL: entry
; CHECK: %bc = bitcast
; CHECK: %[[p1:[A-Za-z0-9_]+]] = extractelement
; CHECK: %[[p2:[A-Za-z0-9_]+]] = extractelement
; CHECK: llvm.experimental.gc.statepoint
; CHECK: %[[p2]].relocated = {{.+}} @llvm.experimental.gc.relocate
; CHECK: %[[p1]].relocated = {{.+}} @llvm.experimental.gc.relocate
; CHECK: load atomic
%bc = bitcast <8 x i8 addrspace(1)*> undef to <8 x i32 addrspace(1)*>
%ptr= extractelement <8 x i32 addrspace(1)*> %bc, i32 7
%0 = call i8 addrspace(1)* @foo() [ "deopt"() ]
%1 = load atomic i32, i32 addrspace(1)* %ptr unordered, align 4
ret i32 %1
}