[PATCH] Make StringMap aware of POD types
benny.kra at gmail.com
Mon Mar 17 12:03:55 PDT 2014
On 17.03.2014, at 19:57, Benjamin Kramer <benny.kra at gmail.com> wrote:
> 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.
I misread. The patch is disabling isPODLike for a class instead of enabling it. That should never be necessary, maybe our default version of isPODLike is too strong?
More information about the llvm-commits