[PATCH] Make StringMap aware of POD types

Benjamin Kramer benny.kra at gmail.com
Mon Mar 17 11:57:54 PDT 2014


On 17.03.2014, at 19:47, Pete Cooper <peter_cooper at apple.com> wrote:

> Hi all
> 
> Please review this patch to make StringMap be aware of when it contains POD types allocated on a BumpPtrAllocator.  In this case its unnecessary to clear the map in its destructor.  This is particularly painful on IdentiferTable in clang where we walk an 8192 entry map of pointers and uselessly destruct them.

Ugh. This is really something that the optimizer should do. Have you checked
what's preventing LLVM from killing the loop that does nothing?

> Unfortunately I needed to move a couple of class declarations inside their headers instead of cpp files (to use isPODLike), but otherwise I hope this looks ok.  I’m totally open to suggestions on better naming or a better way to enable this functionality.
> 
> There’s also a small clang diff.  I’ll didn’t want to cross-post both lists so will wait until the other details are worked out before I email it there.

If I'm reading the source correctly, clang::tooling::FileMatchTrieNode contains a
std::string. That's very non-POD-like.

- Ben





More information about the llvm-commits mailing list