<div dir="ltr">Thanks for your reply, escha,<div><br></div><div>Yes, -loop-rorate makes it work.</div><div><br></div><div>Regards,</div><div><br></div><div>Xiangyang</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-12-01 12:48 GMT-05:00  <span dir="ltr"><<a href="mailto:escha@apple.com" target="_blank">escha@apple.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Dec 1, 2015, at 9:30 AM, Xiangyang Guo via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
> Hi, All,<br>
><br>
> Suppose I define one memory read only intrinsic function "foo" in Intrinsics.td like this<br>
><br>
> def int_foo : Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrReadMem]>;<br>
><br>
> Suppose I have the following IR, which means the intrinsic function "foo" is called 10 times in a loop. Since the parameters of function "foo" are invariant and the function "foo" is defined as "IntrReadMem". I assume the '-licm' can move the function call 'foo' out of the loop body. However, after I use "opt test.ll -basicaa -licm -S", the function call 'foo' is still inside the loop body. Do I misunderstand something here? Any suggestions are appreciated. Thanks a lot.<br>
<br>
</span>Does it work if you call -loop-rotate first? Loop unrolling requires loops to be in canonicalized rotated form first, so I wouldn’t be surprised if LICM does as well.<br>
<br>
—escha</blockquote></div><br></div>