diff options
author | Richard Trieu <rtrieu@google.com> | 2019-02-28 04:00:55 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2019-02-28 04:00:55 +0000 |
commit | b37a70f40e1229d44b967c339f65f4acfd56b0ce (patch) | |
tree | 77aca85d12ab502d09cec645c3e871d8b1fefb5b /llvm/lib/Analysis/CallGraphSCCPass.cpp | |
parent | 14d58f598691b8c27d8b4a4cf6181178f1a8c295 (diff) | |
download | bcm5719-llvm-b37a70f40e1229d44b967c339f65f4acfd56b0ce.tar.gz bcm5719-llvm-b37a70f40e1229d44b967c339f65f4acfd56b0ce.zip |
Fix IR/Analysis layering issue with OptBisect
OptBisect is in IR due to LLVMContext using it. However, it uses IR units from
Analysis as well. This change moves getDescription functions from OptBisect
to their respective IR units. Generating names for IR units will now be up
to the callers, keeping the Analysis IR units in Analysis. To prevent
unnecessary string generation, isEnabled function is added so that callers know
when the description needs to be generated.
Differential Revision: https://reviews.llvm.org/D58406
llvm-svn: 355068
Diffstat (limited to 'llvm/lib/Analysis/CallGraphSCCPass.cpp')
-rw-r--r-- | llvm/lib/Analysis/CallGraphSCCPass.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/CallGraphSCCPass.cpp b/llvm/lib/Analysis/CallGraphSCCPass.cpp index ee01f2536fb..eb02042c111 100644 --- a/llvm/lib/Analysis/CallGraphSCCPass.cpp +++ b/llvm/lib/Analysis/CallGraphSCCPass.cpp @@ -681,11 +681,28 @@ Pass *CallGraphSCCPass::createPrinterPass(raw_ostream &OS, return new PrintCallGraphPass(Banner, OS); } +static std::string getDescription(const CallGraphSCC &SCC) { + std::string Desc = "SCC ("; + bool First = true; + for (CallGraphNode *CGN : SCC) { + if (First) + First = false; + else + Desc += ", "; + Function *F = CGN->getFunction(); + if (F) + Desc += F->getName(); + else + Desc += "<<null function>>"; + } + Desc += ")"; + return Desc; +} + bool CallGraphSCCPass::skipSCC(CallGraphSCC &SCC) const { - return !SCC.getCallGraph().getModule() - .getContext() - .getOptPassGate() - .shouldRunPass(this, SCC); + OptPassGate &Gate = + SCC.getCallGraph().getModule().getContext().getOptPassGate(); + return Gate.isEnabled() && !Gate.shouldRunPass(this, getDescription(SCC)); } char DummyCGSCCPass::ID = 0; |