<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 25, 2016 at 6:10 AM, Hubert Tong <span dir="ltr"><<a href="mailto:hubert.reinterpretcast@gmail.com" target="_blank">hubert.reinterpretcast@gmail.<wbr>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"><div class="gmail_extra"><div class="gmail_quote"><span>On Fri, Nov 25, 2016 at 1:42 AM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr">What is the purpose of the union there?<br></div></blockquote></span><div>The
 purpose of the union is to increase portability by ensuring that the 
placement new is not being performed on insufficiently sized or aligned 
memory.<br></div></div></div></div></blockquote><div>Gotcha</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> </div><span><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr">I ask because pretty much no compiler will respecting the unioning without visible accesses  in all cases, because it would ruin most optimization[1]<div><br></div><div>But i'm also not sure it's required in this testcase to make your testcase fail.</div></div></blockquote></span><div>It isn't. The program should be valid, without the union, on platforms where <span style="font-family:monospace,monospace">int</span> and <span style="font-family:monospace,monospace">float</span> have the same size an alignment.<br></div></div></div></div></blockquote><div><br></div><div>Right, so you need to debug that first, and see what's going wrong.</div><div>Without TBAA info in the .ll file, this should just work.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><span><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div dir="ltr"><div><br></div><div>In practice, handling placement new properly in gcc required the equivalent of a new intrinsic (in gcc, it required adding CHANGE_DYNAMIC_TYPE_EXPR).</div></div></blockquote></span><div>Sure; my question is whether or not there is already a solution in the works for LLVM. If not, then I'll try to work with some folks to propose an intrinsic.</div></div></div></div></blockquote><div><br></div><div>I would first focus on understanding why the testcase fails without any TBAA info at all.</div><div>In that case, i would expect it to work.</div><div><br></div></div></div></div>