llvm.org GIT mirror llvm / daee17d
[PlaceSafepoints] Introduce a -spp-no-statepoints flag Summary: This change adds a `-spp-no-statepoints` flag to PlaceSafepoints that bypasses the code that wraps newly introduced polls and existing calls in gc.statepoint. With `-spp-no-statepoints` enabled, PlaceSafepoints effectively becomes a safpeoint **poll** insertion pass. The eventual goal is to "constant fold" this option, along with `-rs4gc-use-deopt-bundles` to `true`, once clients using gc.statepoint are okay doing so. Reviewers: pgavlin, reames, JosephTremoulet Subscribers: sanjoy, mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D16439 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258551 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjoy Das 3 years ago
2 changed file(s) with 35 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
107107 static cl::opt SplitBackedge("spp-split-backedge", cl::Hidden,
108108 cl::init(false));
109109
110 // If true, don't wrap calls (the ones present in the IR, and the ones
111 // introduced due to polls) in gc.statepoint.
112 static cl::opt NoStatepoints("spp-no-statepoints", cl::Hidden,
113 cl::init(false));
114
110115 // Print tracing output
111116 static cl::opt TraceLSP("spp-trace", cl::Hidden, cl::init(false));
112117
660665 ParsePointNeeded.insert(ParsePointNeeded.end(), RuntimeCalls.begin(),
661666 RuntimeCalls.end());
662667 }
668
669 // If we've been asked to not wrap the calls with gc.statepoint, then we're
670 // done. In the near future, this option will be "constant folded" to true,
671 // and the code below that deals with insert gc.statepoint calls will be
672 // removed. Wrapping potentially safepointing calls in gc.statepoint will
673 // then become the responsibility of the RewriteStatepointsForGC pass.
674 if (NoStatepoints)
675 return modified;
676
663677 PollsNeeded.clear(); // make sure we don't accidentally use
664678 // The dominator tree has been invalidated by the inlining performed in the
665679 // above loop. TODO: Teach the inliner how to update the dom tree?
0 ; RUN: opt -spp-no-statepoints -S -place-safepoints < %s | FileCheck %s
1
2 define void @test() gc "statepoint-example" {
3 ; CHECK-LABEL: test(
4 entry:
5 ; CHECK: entry:
6 ; CHECK: call void @do_safepoint()
7 br label %other
8
9 other:
10 ; CHECK: other:
11 call void undef() "gc-leaf-function"
12 ; CHECK: call void @do_safepoint()
13 br label %other
14 }
15
16 declare void @do_safepoint()
17 define void @gc.safepoint_poll() {
18 call void @do_safepoint()
19 ret void
20 }