<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 20, 2018 at 9:29 AM, Jakub (Kuba) Kuderski via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</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">Hi Nuno,<span class=""><br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Except for one bit, which was that it requires correct typing of load/store operations. That is, if you load an i32, it means you are loading a single 32-bit integer, not two 16-bit integers or something else.</span><br></blockquote><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">This is a valid concern because currently nor LLVM nor clang respect this property. Clang may pass several parameters as a single variable, LLVM has optimizations that combine several loads into a single integer load, etc.</span></blockquote><div><br></div></span><div>What are the places in llvm and clang that do this kind of type punning? </div></div></blockquote><div><br></div><div>Clang does this for ABI's all the time.</div><div>Pointers to structs passed as i64, etc.</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>So far I only encountered them in SROA and in memcpys generated by clang. I would be very interested in getting rid of them.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">My personal opinion is that we should fix LLVM/clang such that memory operations are properly typed. We have proposed this through the use of vectors. While there were supporters for this approach, there wasn't a consensus.  To be fair, we didn't implement a complete prototype for this idea nor did we conduct a thorough discussion.</span></blockquote></span><div><br>Would you be able to post a link to these discussions? I would like to understand the potential cons of such change.<br></div></div></blockquote><div><br></div><div>While i'm a big supported of proper typing (because we are otherwise just throwing valuable aliasing info away, and already suffer for it), people seem to want to move in the other direction, and it would likely require a stronger type system in LLVM anyway.</div><div><br></div></div></div></div>