[cfe-dev] [RFC] Identifying wasteful template function bodies

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Wed Dec 4 10:44:03 PST 2019


ClangBuildAnalyzer is interesting. I used it to make one change to LLVM
already:
https://github.com/llvm/llvm-project/commit/285cf9a84e1bd2f601b097fc29f75ea4c7779eba

You can see the analysis output that change was informed by here:
https://reviews.llvm.org/P8171
The next area of interest I identified was printAliasInstr, which produced
this patch:
https://reviews.llvm.org/D70650

On Wed, Dec 4, 2019 at 8:51 AM Ben Craig via cfe-dev <cfe-dev at lists.llvm.org>
wrote:

> Note that https://github.com/aras-p/ClangBuildAnalyzer already has some
> information that helps in these kinds of diagnosing.  It consumes the
> traces from -ftime-trace.  It has good ways of saying which template
> instantiations took too long over your code base, and hacky ways of saying
> which templates took too long to instantiate (I wrote the hacky thing).
> Here's a more recent view into the output that you can get:
> https://github.com/aras-p/ClangBuildAnalyzer/blob/master/tests/self-win-clang-cl-9.0rc2/_AnalysisOutputExpected.txt
>
> I will say that one gap in this profiling tool is large quantities of tiny
> functions / templates, e.g. std::move.  -ftime-trace won't trace events
> that are sufficiently small, so it can miss things like std::move that
> involve a huge quantity of tiny instantiations.
>
> > -----Original Message-----
> > From: cfe-dev <cfe-dev-bounces at lists.llvm.org> On Behalf Of Brian Gesiak
> > via cfe-dev
> > Sent: Wednesday, December 4, 2019 10:04 AM
> > To: David Blaikie <dblaikie at gmail.com>
> > Cc: cfe-dev <cfe-dev at lists.llvm.org>
> > Subject: [EXTERNAL] Re: [cfe-dev] [RFC] Identifying wasteful template
> > function bodies
> >
> > Awesome, thanks all!
> >
> > > On Mon, Dec 2, 2019 at 2:42 PM Reid Kleckner via cfe-dev <cfe-
> > dev at lists.llvm.org> wrote:
> > >> I like this idea. I'm not sure a warning is the best way to surface
> it. The first
> > alternative that occurs to be would be the -ftime-trace JSON file, so
> you can
> > dump out complete info about the most often instantiated templates, how
> > many nodes they contained, and how many of them were dependent.
> >
> > This is a great idea. I'll try to get this working and send a patch.
> >
> > The discussion on ADL was interesting as well. I'm glad I asked the list,
> > thanks!
> >
> > - Brian
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > https://urldefense.com/v3/__https://lists.llvm.org/cgi-
> > bin/mailman/listinfo/cfe-dev__;!!FbZ0ZwI3Qg!-
> > pVFNcaaFVYdPdIuBJkdNWBPr_-Z-PjM8KlbAi71-2e56yNnxYZYarYnQ6WN$
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191204/d2512713/attachment.html>


More information about the cfe-dev mailing list