<html><body><p><font size="2">The variables ptra and ptrb don't actually alias.  A simple way to think of aliasing is to to say two l-values alias if assigning into one changes the other.  In your program changing the value of ptra does not change the value of ptrb.  What you do have is two pointers that point to the same l-value.  The aliasing analysis will show that variable a (which is address taken) is aliased to a shadow of type int.  Any indirections through ptra or ptrb will use that same shadow.  This is how clang and llvm get the aliasing correct.  </font><br><br><font size="2">This is a common mistake when learning about aliasing.  People often think the pointer should alias the object.  It's really the shadow (i.e. a pointer indirection) that aliases the object.  In fact you can never have two variables ever alasing each other.  </font><br><font size="2"><br>Regards<br>--<br>Sean Perry<br>Compiler Development<br>IBM Canada Lab<br>(905)-413-6031 (tie 313-6031), fax (905)-413-4839<br></font><br><br><img width="16" height="16" src="cid:1__=8FBB09F2DFF7675F8f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for "Артём Вопилов via llvm-dev" ---12/12/2018 11:54:24 AM---Dear LLVM Developers, My name is"><font size="2" color="#424282">"Артём Вопилов via llvm-dev" ---12/12/2018 11:54:24 AM---Dear LLVM Developers, My name is Artem Vopilov, I am a student at TU Darmstadt. I am writing to you</font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">"Артём Вопилов via llvm-dev" <llvm-dev@lists.llvm.org></font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">llvm-admin@lists.llvm.org, llvm-dev@lists.llvm.org, mailman@lists.llvm.org, bugs-admin@lists.llvm.org</font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">12/12/18 11:54 AM</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">[llvm-dev] LLVM Alias Analysis</font><br><font size="2" color="#5F5F5F">Sent by:        </font><font size="2">"llvm-dev" <llvm-dev-bounces@lists.llvm.org></font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><tt><font size="2">Dear LLVM Developers,<br><br>My name is Artem Vopilov, I am a student at TU Darmstadt. I am writing to you to ask about Alias Analysis.<br><br>I am using llvm to analyze alias between variables in programs. I am using Alias Analysis implemented in llvm with command "opt -analyze -aa-eval -print-all-alias-modref-info" and for printing sets of alias "opt -analyze -aa-eval -print-alias-sets".<br><br>I execute these commands on the small test program I attached to this email.<br>If you take a look at it, it will be obvious, that variables "ptra" and "ptrb" alias. However, the results of Alias Analysis do not indicate, that these variable alias. I would like to ask you, if it is possible to change the source code of Alias Analysis, so that it will show that "ptra" and "ptrb" variables from the test program alias.<br><br>I am looking forward to hearing from you and hope, that you can help me solve my problem.<br><br>Respectfully yours,<br>Artem Vopilov<br>[attachment "Test.c" deleted by Sean Perry/Toronto/IBM] </font></tt><br><tt><font size="2">_______________________________________________<br>LLVM Developers mailing list<br>llvm-dev@lists.llvm.org<br></font></tt><tt><font size="2"><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></font></tt><tt><font size="2"><br></font></tt><br><br><BR>
</body></html>