<div dir="ltr">For more weird things, the APInt constructor from uint64_t writes 0 to VAL first presumably to 0 the entire union which again assumes that's the largest union member? Then overwrites it completely in the small case or lets the slow case init overwrite the pointer part of it on 32-bit architectures.<div><br></div><div>The copy constructor does something similar.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote">On Sun, Mar 5, 2017 at 2:32 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><span class=""><div dir="ltr">On Sun, Mar 5, 2017 at 8:29 AM Craig Topper via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">craig.topper added a comment.<br class="m_4522731980712995465gmail_msg">
<br class="m_4522731980712995465gmail_msg">
Removing the And, Or, Xor functions could be removed separately.<br class="m_4522731980712995465gmail_msg">
<br class="m_4522731980712995465gmail_msg">
The change to getBitsSet and intersects were necessary because of the operator functions being moved out of line. But they could be done as a pre-patch.<br class="m_4522731980712995465gmail_msg"></blockquote></span><div><br>If you like, might make the patch quicker/easier to review.<br> </div><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="m_4522731980712995465gmail_msg">
I hadn't looked at the move constructor. I was basing this on r276470 and assuming it was ok. Should I change it to use memcpy like the move assignment operator?<br class="m_4522731980712995465gmail_msg"></blockquote></span><div><br>Even the assignment operator sort of seems not quite right - but maybe I'm being overly cautious/incorrect here. (I'd expect it to need to memcpy the union itself (which would need a name)).<br><br>Could also use the 'unified assignment operator' style - simplifying the copy/move assignment operator to rely on the copy/move ctors.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="m_4522731980712995465gmail_msg">
<br class="m_4522731980712995465gmail_msg">
<a href="https://reviews.llvm.org/D30612" rel="noreferrer" class="m_4522731980712995465gmail_msg" target="_blank">https://reviews.llvm.org/<wbr>D30612</a><br class="m_4522731980712995465gmail_msg">
<br class="m_4522731980712995465gmail_msg">
<br class="m_4522731980712995465gmail_msg">
<br class="m_4522731980712995465gmail_msg">
</blockquote></div></div>
</blockquote></div><br></div>