Skip to content

Commit

Permalink
[PlaceSafepoints] Switch to being a FunctionPass
Browse files Browse the repository at this point in the history
The pass doesn't actually modify the module outside of the function being processed. The only confusing piece is that it both inserts calls and then inlines the resulting calls. Given that, it definitely invalidates module level analysis results, but many FunctionPasses do that.

Differential Revision: http://reviews.llvm.org/D9590

llvm-svn: 237185
  • Loading branch information
preames committed May 12, 2015
1 parent bef5ff3 commit 7b98179
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/Transforms/Scalar.h
Expand Up @@ -442,7 +442,7 @@ FunctionPass *createStraightLineStrengthReducePass();
// RewriteStatepointsForGC which can be run at an arbitrary point in the pass
// order following this pass.
//
ModulePass *createPlaceSafepointsPass();
FunctionPass *createPlaceSafepointsPass();

//===----------------------------------------------------------------------===//
//
Expand Down
17 changes: 6 additions & 11 deletions llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp
Expand Up @@ -166,20 +166,13 @@ static cl::opt<bool> NoCall("spp-no-call", cl::Hidden, cl::init(false));
static cl::opt<bool> NoBackedge("spp-no-backedge", cl::Hidden, cl::init(false));

namespace {
struct PlaceSafepoints : public ModulePass {
struct PlaceSafepoints : public FunctionPass {
static char ID; // Pass identification, replacement for typeid

PlaceSafepoints() : ModulePass(ID) {
PlaceSafepoints() : FunctionPass(ID) {
initializePlaceSafepointsPass(*PassRegistry::getPassRegistry());
}
bool runOnModule(Module &M) override {
bool modified = false;
for (Function &F : M) {
modified |= runOnFunction(F);
}
return modified;
}
bool runOnFunction(Function &F);
bool runOnFunction(Function &F) override;

void getAnalysisUsage(AnalysisUsage &AU) const override {
// We modify the graph wholesale (inlining, block insertion, etc). We
Expand Down Expand Up @@ -755,7 +748,9 @@ bool PlaceSafepoints::runOnFunction(Function &F) {
char PlaceBackedgeSafepointsImpl::ID = 0;
char PlaceSafepoints::ID = 0;

ModulePass *llvm::createPlaceSafepointsPass() { return new PlaceSafepoints(); }
FunctionPass *llvm::createPlaceSafepointsPass() {
return new PlaceSafepoints();
}

INITIALIZE_PASS_BEGIN(PlaceBackedgeSafepointsImpl,
"place-backedge-safepoints-impl",
Expand Down

0 comments on commit 7b98179

Please sign in to comment.