[PATCH] Move semantics for ValueMap

Pete Cooper peter_cooper at apple.com
Mon Apr 27 09:59:07 PDT 2015


Hi Rafael, David

In http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150420/273199.html <http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150420/273199.html>, Rafael suggested returning a ValueMap from CloneFunction.

Turns out that ValueMap has a deleted copy constructor, and no move constructor all.  This patch adds the move constructor (and assignment operator). The default implementations of both of these seem to be fine.

To test this, i managed to get the Constructible class from the SmallVector unit test to wrap a Value*, then use that to count all the times the ValueMap does any of the operators.  I then went through the ValueMap and DenseMap code to verify each of the values i’m checking against.  I left some printf’s in an #if 0 for future use in case we want to easily check the values coming out of this code.

Cheers,
Pete

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150427/dcc7bb86/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: move-valuemap.diff
Type: application/octet-stream
Size: 7375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150427/dcc7bb86/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150427/dcc7bb86/attachment-0001.html>


More information about the llvm-commits mailing list