diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2016-06-23 22:51:14 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2016-06-23 22:51:14 +0000 |
| commit | 586fc7c5be10959e35ad6b110b591ec47fa44215 (patch) | |
| tree | 030efc96301130fabdd4303a2cda5f44cfcfb93a | |
| parent | ae9c904a4c4a770ea06cc7f46aedca3399392a98 (diff) | |
| download | bcm5719-llvm-586fc7c5be10959e35ad6b110b591ec47fa44215.tar.gz bcm5719-llvm-586fc7c5be10959e35ad6b110b591ec47fa44215.zip | |
[LCG] Make the name of an SCC include more of the functions in it.
This makes it much easier to debug issues when the logging contains the
name of the SCC. It requires to create a temporary string, but for
logging and debugging uses that seems fine. I've added logic to try to
output all the function names with an elipsis if there are too many.
This was helpful fro me in debugging issues with the new pass manager.
llvm-svn: 273625
| -rw-r--r-- | llvm/include/llvm/Analysis/LazyCallGraph.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/include/llvm/Analysis/LazyCallGraph.h b/llvm/include/llvm/Analysis/LazyCallGraph.h index 34d854c78fe..340ca491574 100644 --- a/llvm/include/llvm/Analysis/LazyCallGraph.h +++ b/llvm/include/llvm/Analysis/LazyCallGraph.h @@ -377,7 +377,23 @@ public: /// /// We use the name of the first function in the SCC to name the SCC for /// the purposes of debugging and logging. - StringRef getName() const { return begin()->getFunction().getName(); } + std::string getName() const { + std::string Name; + int i = 0; + for (Node &N : *this) { + if (i > 0) + Name += ", "; + // Elide the inner elements if there are too many. + if (i > 8) { + Name += "..., "; + Name += Nodes.back()->getFunction().getName().str(); + break; + } + Name += N.getFunction().getName().str(); + ++i; + } + return Name; + } }; /// A RefSCC of the call graph. |

