<div><div dir="auto">Got it, thanks guys.</div></div><div dir="auto"><br></div><div dir="auto">The aa pass does say that load(load(@ppc,...)) May-aliases with load(pc) and for the NoAlias dump that I shared, two different globals ppc and pc do not alias- There is most likely something else in my copy of llvm that makes my test fail. Thanks 🙏 very much for your help! </div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 8, 2020 at 3:14 AM Jeroen Dobbelaere <<a href="mailto:Jeroen.Dobbelaere@synopsys.com">Jeroen.Dobbelaere@synopsys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div class="m_-7344912779066986262WordSection1">
<p class="MsoNormal">Hi Ramshankar,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">giving it a try:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">> The result from the AA-Evaluator prints this:<u></u><u></u></p>
<p class="MsoNormal">> NoAlias: i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @pc, i32 0, i32 0), i8*** @ppc<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">- the first is an 'i8**' (the address of pc), <u></u><u></u></p>
<p class="MsoNormal">- the second 'i8***' (aka the address of ppc.)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Those represent two different objects.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Greetings,</p></div></div><div lang="EN-US" link="blue" vlink="purple"><div class="m_-7344912779066986262WordSection1"><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Jeroen Dobbelaere<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>> <b>On Behalf Of
</b>ramshankar r via llvm-dev<br>
<b>Sent:</b> Tuesday, July 7, 2020 18:16<br>
<b>To:</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm-dev] Question about basic-aa's assumptions<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">Any takers on this?<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Best,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Ram<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Mon, Jul 6, 2020 at 12:18 PM ramshankar r <<a href="mailto:ramshankar543@gmail.com" target="_blank">ramshankar543@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I have a test-case for which I seem to be getting incorrect information from basic-aa alias-analysis. Here it is:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">#include <stdio.h><br>
#define ARR_SIZE 4<br>
char c[ARR_SIZE];<br>
char *pc[ARR_SIZE];<br>
char **ppc = pc;<br>
<br>
int main() {<br>
<br>
pc[0] = &c[0];<br>
pc[1] = &c[1];<br>
pc[2] = &c[2];<br>
pc[3] = &c[3];<br>
<br>
printf(" ppc: %p\n"<br>
" pc : %p\n"<br>
" c : %p\n"<br>
" *pc: %p\n",<br>
ppc, pc, c, *pc);<br>
<br>
return 0;<br>
}<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">The way I compiled it is as follows:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">clang -m32 -g pointer.c -emit-llvm -S -c<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">opt pointer.ll -aa-pipeline=basic-aa -passes=aa-eval -print-all-alias-modref-info -disable-output
<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">The result from the AA-Evaluator prints this:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> NoAlias: i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @pc, i32 0, i32 0), i8*** @ppc<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">If we run the program, the result is this:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> ppc: 0x565ee028<br>
pc : 0x565ee028<br>
c : 0x565ee024<br>
*pc: 0x565ee024<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Basically, I would have liked if basic-aa said ppc and pc are may-aliased to start with for this kind of usage. This is how the globals look like. The second one: "ppc" has "pc" on the right hand side.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><br>
@pc = common dso_local global [4 x i8*] zeroinitializer, align 4, !dbg !0<br>
@ppc = dso_local global i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @pc, i32 0, i32 0), align 4, !dbg !6<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Best regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Ram<u></u><u></u></p>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote></div></div>