<div dir="ltr"><div dir="ltr">Hi Hiroshi,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 19 Jun 2020 at 21:20, Hiroshi Yamauchi <<a href="mailto:yamauchi@google.com">yamauchi@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif">If you see the LLVM IR output, the second line is lowered into a load/store of an int. Maybe that's why.</div></div></blockquote><div><br></div><div><div style="background-color:rgb(255,255,254);font-family:"Consolas, ""><div style="">%7 = load i32, i32* %5, align 4, !dbg !39, !tbaa !40 <br>store i32 %7, i32* %6, align 4, !dbg !39, !tbaa !40<br><br>yes the structure copy seem to happen as integer type load and store. Sometimes I also see structure type bitcasted to integer pointer type and then load/store happens in integer type.<br><br>Alias is conservatively saying may-alias? <br></div><div style=""><br></div><div style="">regards,</div><div style="">venkat.</div></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif"><a href="https://godbolt.org/z/u3VyAM" target="_blank">https://godbolt.org/z/u3VyAM</a><br></div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">I'm not sure what the strict aliasing rules say about this, though.</div><div style="font-family:arial,helvetica,sans-serif"><br></div><div style="font-family:arial,helvetica,sans-serif">HTH</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 18, 2020 at 10:16 PM Venkataramanan Kumar via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><br></div><div><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">----Snip--<br>struct st1{<br> int a;<br>};<br>struct st2{<br> int b;<br>};<br>struct st { <br> struct st1 obj1; <br> struct st2 obj2;<br>}Obj;<br><br>int test1(struct st1 * ptr1 , struct st2 * ptr2, struct st2 *ptr3) {<br> ptr1->a = 10; <br> *ptr3 = *ptr2;<br> return ptr1->a;<br>}<br>--Snip---<br><br>For the above case GCC is able to store forward the value 10 to the return place.<br>LLVM is not doing this. <br>GCC<br><a href="https://godbolt.org/z/FCjCXy" target="_blank">https://godbolt.org/z/FCjCXy</a> <br>LLVM <br><a href="https://godbolt.org/z/TFgnig" target="_blank">https://godbolt.org/z/TFgnig</a><br><br>My understanding is that under strict aliasing rules accessing objects of different types don't alias. <br>In this case we are accessing "struct st2" object and "int" type object. so aliasing should not prevent the forwarding of store 10 to the return place .<br><br>Can someone please clarify this?</p><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><br>regards,<br>Venkat.<br></p><p class="MsoNormal" style="margin:0in 0in 0.0001pt"></p></div><div>: </div></div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div></div>