<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">To Artem:<div class="">Next time It will be great if you also attach the IR code you feed into your opt analyze command, the output result, and point out that why you think ptra and ptrb don’t alias.</div><div class=""><br class=""></div><div class="">And basically I agree what Sean stated in this thread: a pointer is just a variable containing memory address, so pointer itself will never alias with other pointers, but the ‘pointee’ will alias with other memory addresses.</div><div class=""><br class=""></div><div class="">Bekket<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 12, 2018, at 10:36 AM, Sean Perry via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><p style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><font size="2" class="">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.<span class="Apple-converted-space"> </span><span class="Apple-converted-space"> </span></font><br class=""><br class=""><font size="2" class="">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.<span class="Apple-converted-space"> </span><span class="Apple-converted-space"> </span></font><br class=""><font size="2" class=""><br class="">Regards<br class="">--<br class="">Sean Perry<br class="">Compiler Development<br class="">IBM Canada Lab<br class=""><a href="tel:(905)-413-6031" class="">(905)-413-6031</a><span class="Apple-converted-space"> </span>(tie<span class="Apple-converted-space"> </span><a href="tel:313-6031" class="">313-6031</a>), fax<span class="Apple-converted-space"> </span><a href="tel:(905)-413-4839" class="">(905)-413-4839</a><br class=""></font><br class=""><br class=""><span id="cid:1__=8FBB09F2DFF7675F8f9e8a93df938690918c8FB@"><graycol.gif></span><font size="2" color="#424282" class="">"Артём Вопилов 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 class=""><br class=""><font size="2" color="#5F5F5F" class="">From:<span class="Apple-converted-space"> </span><span class="Apple-converted-space"> </span></font><font size="2" class="">"Артём Вопилов via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>></font><br class=""><font size="2" color="#5F5F5F" class="">To:<span class="Apple-converted-space"> </span><span class="Apple-converted-space"> </span></font><font size="2" class=""><a href="mailto:llvm-admin@lists.llvm.org" class="">llvm-admin@lists.llvm.org</a>,<span class="Apple-converted-space"> </span><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>,<span class="Apple-converted-space"> </span><a href="mailto:mailman@lists.llvm.org" class="">mailman@lists.llvm.org</a>,<span class="Apple-converted-space"> </span><a href="mailto:bugs-admin@lists.llvm.org" class="">bugs-admin@lists.llvm.org</a></font><br class=""><font size="2" color="#5F5F5F" class="">Date:<span class="Apple-converted-space"> </span><span class="Apple-converted-space"> </span></font><font size="2" class="">12/12/18 11:54 AM</font><br class=""><font size="2" color="#5F5F5F" class="">Subject:<span class="Apple-converted-space"> </span><span class="Apple-converted-space"> </span></font><font size="2" class="">[llvm-dev] LLVM Alias Analysis</font><br class=""><font size="2" color="#5F5F5F" class="">Sent by:<span class="Apple-converted-space"> </span><span class="Apple-converted-space"> </span></font><font size="2" class="">"llvm-dev" <<a href="mailto:llvm-dev-bounces@lists.llvm.org" class="">llvm-dev-bounces@lists.llvm.org</a>></font><br class=""></p><hr width="100%" size="2" align="left" noshade="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; color: rgb(128, 145, 165);" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><tt style="caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><font size="2" class="">Dear LLVM Developers,<br class=""><br class="">My name is Artem Vopilov, I am a student at TU Darmstadt. I am writing to you to ask about Alias Analysis.<br class=""><br class="">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 class=""><br class="">I execute these commands on the small test program I attached to this email.<br class="">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 class=""><br class="">I am looking forward to hearing from you and hope, that you can help me solve my problem.<br class=""><br class="">Respectfully yours,<br class="">Artem Vopilov<br class="">[attachment "Test.c" deleted by Sean Perry/Toronto/IBM]<span class="Apple-converted-space"> </span></font></tt><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><tt style="caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><font size="2" class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class=""></font></tt><tt style="caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><font size="2" class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></font></tt><tt style="caret-color: rgb(0, 0, 0); font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><font size="2" class=""><br class=""></font></tt><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">LLVM Developers mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="mailto:llvm-dev@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">llvm-dev@lists.llvm.org</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></div></blockquote></div><br class=""></div></body></html>