blob: 1f781a4ce195d728e57da2a4811ee9629dee5cf6 [file] [log] [blame]
Daniel Neilson82daad32018-03-05 22:27:30 +00001; RUN: opt -S -rewrite-statepoints-for-gc < %s | FileCheck %s
2; RUN: opt -S -passes=rewrite-statepoints-for-gc < %s | FileCheck %s
3;
4; Regression test:
5; After the rewritable callsite collection if any callsite was found
6; in a block that was reported unreachable by DominanceTree then
7; removeUnreachableBlocks() was called. But it is stronger than
8; DominatorTree::isReachableFromEntry(), i.e. removeUnreachableBlocks
9; can remove some blocks for which isReachableFromEntry() returns true.
10; This resulted in stale pointers to the collected but removed
11; callsites. Such stale pointers caused crash when accessed.
12declare void @f(i8 addrspace(1)* %obj)
13
14define void @test(i8 addrspace(1)* %arg) gc "statepoint-example" {
15; CHECK-LABEL: test(
16; CHECK-NEXT: @f
17 call void @f(i8 addrspace(1)* %arg) #1
18 br i1 true, label %not_zero, label %zero
19
20not_zero:
21 ret void
22
23; This block is reachable but removed by removeUnreachableBlocks()
24zero:
25; CHECK-NOT: @f
26 call void @f(i8 addrspace(1)* %arg) #1
27 ret void
28
29unreach:
30 call void @f(i8 addrspace(1)* %arg) #1
31 ret void
32}
33
34attributes #1 = { norecurse noimplicitfloat }