34 lines · plain
1; RUN: opt -S -passes=rewrite-statepoints-for-gc < %s | FileCheck %s2;3; Regression test:4; After the rewritable callsite collection if any callsite was found5; in a block that was reported unreachable by DominanceTree then6; removeUnreachableBlocks() was called. But it is stronger than7; DominatorTree::isReachableFromEntry(), i.e. removeUnreachableBlocks8; can remove some blocks for which isReachableFromEntry() returns true.9; This resulted in stale pointers to the collected but removed10; callsites. Such stale pointers caused crash when accessed.11declare void @f(ptr addrspace(1) %obj)12 13define void @test(ptr addrspace(1) %arg) gc "statepoint-example" {14; CHECK-LABEL: test(15; CHECK-NEXT: @f16 call void @f(ptr addrspace(1) %arg) #117 br i1 true, label %not_zero, label %zero18 19not_zero:20 ret void21 22; This block is reachable but removed by removeUnreachableBlocks()23zero:24; CHECK-NOT: @f25 call void @f(ptr addrspace(1) %arg) #126 ret void27 28unreach:29 call void @f(ptr addrspace(1) %arg) #130 ret void31}32 33attributes #1 = { norecurse noimplicitfloat }34