<html><head><base href="x-msg://3891/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 1, 2009, at 6:58 PM, dan mihai wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">Hi,<br><br>I am trying to use alias analysis (Anderson) and noticed that for pointers to functions<span class="Apple-converted-space"> </span><br>I don't get the expected result: a pointer that clearly may point to a function is<span class="Apple-converted-space"> </span><br>reported as NoAlias.<br></div></span></blockquote><div><br></div>Hi Dan,</div><div><br></div><div>Andersaa is extremely experimental at this point and has many known bugs.</div><div><br></div><div>-Chris</div><div><br><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; "><br>I use -anders-aa -aa-eval -print-no-aliases -print-may-aliases -print-must-aliases<br><br>Here is a test case:<br><br>///////////////try_calls_aliases.c<span class="Apple-converted-space"> </span><br>#include <stdio.h><br><br>typedef int (*PF)();<br><br>PF pf01=0;<br>PF pf2=0;<br><br>int pointed_to_function0() {<br> printf("pointed_to_function0\n");<br> return 1;<br>}<br><br>int pointed_to_function1() {<br> pf01 = pointed_to_function1;<br> printf("pointed_to_function1\n");<br> return 1;<br>}<br><br>void ptr_function_caller(PF pf) {<br> printf("ptr_function_caller\n");<br> pf();<br> PF lpf0 = pointed_to_function0;<br> PF lpf1 = pointed_to_function1;<br>}<br><br>int main(int argc, char* argv[]) {<br> ptr_function_caller(pointed_to_function0);<br> return 0;<br>}<br>-------------<br><br>After<br> llvmgcc -emit-llvm try_calls_aliases.c -c -o try_calls_aliases.bc<br> opt 2>&1 -anders-aa -aa-eval -print-no-aliases -print-may-aliases -print-must-aliases try_calls_aliases.bc | egrep -e 'Alias|Function' > c<br>I get:<br>...........<br>Function: ptr_function_caller: 8 pointers, 2 call sites<br> NoAlias: i32 (...)* bitcast (i32 ()* @pointed_to_function0 to i32 (...)*), i32 (...)* bitcast (i32 ()* @pointed_to_function1 to i32 (...)*)<br> NoAlias: i32 (...)* %pf, i32 (...)* bitcast (i32 ()* @pointed_to_function0 to i32 (...)*) ???????????????????????????????????????????????????????????????????????????????<br> NoAlias: i32 (...)* %pf, i32 (...)* bitcast (i32 ()* @pointed_to_function1 to i32 (...)*)<br> NoAlias: i32 (...)* bitcast (i32 ()* @pointed_to_function0 to i32 (...)*), i8* getelementptr ([20 x i8]* @.str2, i32 0, i64 0)<br> NoAlias: i32 (...)* bitcast (i32 ()* @pointed_to_function1 to i32 (...)*), i8* getelementptr ([20 x i8]* @.str2, i32 0, i64 0)<br> NoAlias: i32 (...)* %pf, i8* getelementptr ([20 x i8]* @.str2, i32 0, i64 0)<br> NoAlias: i32 (...)* bitcast (i32 ()* @pointed_to_function0 to i32 (...)*), i32 (...)** %pf_addr<br> NoAlias: i32 (...)* bitcast (i32 ()* @pointed_to_function1 to i32 (...)*), i32 (...)** %pf_addr<br> NoAlias: i32 (...)* %pf, i32 (...)** %pf_addr<br> NoAlias: i32 (...)** %pf_addr, i8* getelementptr ([20 x i8]* @.str2, i32 0, i64 0)<br> NoAlias: i32 (...)* bitcast (i32 ()* @pointed_to_function0 to i32 (...)*), i32 (...)** %lpf1<br> NoAlias: i32 (...)* bitcast (i32 ()* @pointed_to_function1 to i32 (...)*), i32 (...)** %lpf1<br> NoAlias: i32 (...)* %pf, i32 (...)** %lpf1<br> NoAlias: i32 (...)** %lpf1, i8* getelementptr ([20 x i8]* @.str2, i32 0, i64 0)<br> NoAlias: i32 (...)** %lpf1, i32 (...)** %pf_addr<br> NoAlias: i32 (...)* bitcast (i32 ()* @pointed_to_function0 to i32 (...)*), i32 (...)** %lpf0<br> NoAlias: i32 (...)* bitcast (i32 ()* @pointed_to_function1 to i32 (...)*), i32 (...)** %lpf0<br> NoAlias: i32 (...)* %pf, i32 (...)** %lpf0<br> NoAlias: i32 (...)** %lpf0, i8* getelementptr ([20 x i8]* @.str2, i32 0, i64 0)<br> NoAlias: i32 (...)** %lpf0, i32 (...)** %pf_addr<br> NoAlias: i32 (...)** %lpf0, i32 (...)** %lpf1<br> NoAlias: i32 (...)* %1, i32 (...)* bitcast (i32 ()* @pointed_to_function0 to i32 (...)*)<br> NoAlias: i32 (...)* %1, i32 (...)* bitcast (i32 ()* @pointed_to_function1 to i32 (...)*)<br> MayAlias: i32 (...)* %1, i32 (...)* %pf<br> NoAlias: i32 (...)* %1, i8* getelementptr ([20 x i8]* @.str2, i32 0, i64 0)<br> NoAlias: i32 (...)* %1, i32 (...)** %pf_addr<br> NoAlias: i32 (...)* %1, i32 (...)** %lpf1<br> NoAlias: i32 (...)* %1, i32 (...)** %lpf0<br>...............<br><br>Any advice on how to get this work as expected? (that is pf MayAlias pointed_to_function0 inside ptr_function_caller, etc)?<br><br>Thank you,<br>Dan<br><br><br><br><hr>Insert movie times and more without leaving HotmailŪ.<span class="Apple-converted-space"> </span><a href="http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009" target="_new">See how.</a>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a><span class="Apple-converted-space"> </span> <a href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></div></span></blockquote></div><br></body></html>