1 ; RUN: opt -S -passes=rewrite-statepoints-for-gc < %s | FileCheck %s
4 ; After the rewritable callsite collection if any callsite was found
5 ; in a block that was reported unreachable by DominanceTree then
6 ; removeUnreachableBlocks() was called. But it is stronger than
7 ; DominatorTree::isReachableFromEntry(), i.e. removeUnreachableBlocks
8 ; can remove some blocks for which isReachableFromEntry() returns true.
9 ; This resulted in stale pointers to the collected but removed
10 ; callsites. Such stale pointers caused crash when accessed.
11 declare void @f(ptr addrspace(1) %obj)
13 define void @test(ptr addrspace(1) %arg) gc "statepoint-example" {
16 call void @f(ptr addrspace(1) %arg) #1
17 br i1 true, label %not_zero, label %zero
22 ; This block is reachable but removed by removeUnreachableBlocks()
25 call void @f(ptr addrspace(1) %arg) #1
29 call void @f(ptr addrspace(1) %arg) #1
33 attributes #1 = { norecurse noimplicitfloat }