<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Okay, I have tried the following:</p>
<p style="margin-top:0;margin-bottom:0"><span> bin/opt -mem2reg -basicaa -cfl-anders-aa -print-alias-sets bin/test/test.bc</span><br>
</p>
<p style="margin-top:0;margin-bottom:0"><span>But, the result is same as last time. Do you mean something like this to try? Can you suggest what else could be an important factor for this issue?</span></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font face="'Comic Sans MS',Fantasy,cursive">Best Regards<br>
<font face="'Comic Sans MS',Fantasy,cursive">Mustakimur Rahman Khandaker<br>
<font face="'Comic Sans MS',Fantasy,cursive">G<font face="'Comic Sans MS',Fantasy,cursive">raduate Student and Teaching Assistant<br>
<font face="'Comic Sans MS',Fantasy,cursive">Department of Computer Science<br>
<font face="'Comic Sans MS',Fantasy,cursive">Florida State University</font><br>
</font></font></font></font></font></div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Friedman, Eli <efriedma@codeaurora.org><br>
<b>Sent:</b> Monday, April 16, 2018 1:51:14 PM<br>
<b>To:</b> Mustakimur Khandaker; llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm-dev] LLVM Alias Analysis (Load and store from same address is not showed up in same set)</font>
<div> </div>
</div>
<div style="background-color:#FFFFFF">
<div class="x_moz-cite-prefix">On 4/15/2018 11:44 AM, Mustakimur Khandaker via llvm-dev wrote:<br>
</div>
<blockquote type="cite"><style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<div>Hi </div>
<div>I have this simple c code for which I would like to use for alias analysis. </div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px">
<div>#include <stdio.h></div>
<div>#include <stdlib.h></div>
<div><br>
</div>
<div>static int (*fp) (void); </div>
<div>void ind_call (int (*compr)(void)){ </div>
<div>    fp = compr; </div>
<div>    fp(); </div>
<div>} </div>
<div>int hello(void){ </div>
<div>    return printf("hello world\n"); </div>
<div>} </div>
<div>int main(){ </div>
<div>    ind_call(hello); </div>
<div>    return 0; </div>
<div>} </div>
</blockquote>
<div><br>
</div>
<div>So, I do the following: </div>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px">
<div>bin/opt -basicaa -cfl-anders-aa -print-alias-sets bin/test/test.bc </div>
</blockquote>
<div><br>
</div>
<div>I get the following result: </div>
<blockquote style="margin:0 0 0 40px; border:none; padding:0px">
<div>Alias sets for function 'ind_call': </div>
<div>Alias Set Tracker: 2 alias sets for 2 pointer values. </div>
<div>  AliasSet[0x91a5820, 1] must alias, Mod/Ref   Pointers: (i32 ()** %compr.addr, 8) </div>
<div>  AliasSet[0x91a58c0, 2] may alias, Mod/Ref   Pointers: (i32 ()** @fp, 8) </div>
<div>    1 Unknown instructions: i32 %call <br>
</div>
</blockquote>
</div>
</blockquote>
<br>
LLVM's alias analysis is not very smart; it depends on other optimization passes to produce reasonable results.  You should at least run mem2reg before trying to do any alias analysis queries.<br>
<br>
-Eli<br>
<p><br>
</p>
<pre class="x_moz-signature" cols="72">-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
</div>
</body>
</html>