Tim Northover via llvm-dev
2015-Dec-01 20:51 UTC
[llvm-dev] LICM doesn't work for IntrReadMem intrinsic function
On 1 December 2015 at 12:33, Xiangyang Guo via llvm-dev <llvm-dev at lists.llvm.org> wrote:> if I have the following IR, LICM doesn't work again, even if I use > '-loop-rotate' firstly. In this IR, the return value of intrinsic function > "foo" is used by another function "func2" as parameter. However, for the > intrinsic function "foo", the parameters are still loop invariant. Do you > know why this happens? Thanks a lot.Is there anything telling LLVM that func2 won't write to memory and change the value returned by llvm.foo? Cheers. Tim.
Xiangyang Guo via llvm-dev
2015-Dec-01 20:59 UTC
[llvm-dev] LICM doesn't work for IntrReadMem intrinsic function
Actually, no such information is attached to "func2". For the following IR, if "func2" can only access the memory related to the first parameter "%b" and it will not change the value related to second parameter "%2", do you know how I can tell LLVM these information? And if I can do this, probably the LICM will work for llvm.foo? Thanks %2 = call i32 @llvm.foo(i32 %a, i32 1) %3 = call i32 @_Z5func2ii(i32 %b, i32 %2) 2015-12-01 15:51 GMT-05:00 Tim Northover <t.p.northover at gmail.com>:> On 1 December 2015 at 12:33, Xiangyang Guo via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > if I have the following IR, LICM doesn't work again, even if I use > > '-loop-rotate' firstly. In this IR, the return value of intrinsic > function > > "foo" is used by another function "func2" as parameter. However, for the > > intrinsic function "foo", the parameters are still loop invariant. Do you > > know why this happens? Thanks a lot. > > Is there anything telling LLVM that func2 won't write to memory and > change the value returned by llvm.foo? > > Cheers. > > Tim. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151201/ff1931ac/attachment.html>
Xiangyang Guo via llvm-dev
2015-Dec-01 21:00 UTC
[llvm-dev] LICM doesn't work for IntrReadMem intrinsic function
Opps, the IR is %2 = call i32 @llvm.foo(i32 %a, i32 1) %3 = call i32 @_Z5func2ii(i32 %b, i32 %2) 2015-12-01 15:59 GMT-05:00 Xiangyang Guo <eceguo at gmail.com>:> Actually, no such information is attached to "func2". > > For the following IR, if "func2" can only access the memory related to the > first parameter "%b" and it will not change the value related to second > parameter "%2", do you know how I can tell LLVM these information? And if I > can do this, probably the LICM will work for llvm.foo? Thanks > > %2 = call i32 @llvm.foo(i32 %a, i32 1) > %3 = call i32 @_Z5func2ii(i32 %b, i32 %2) > > 2015-12-01 15:51 GMT-05:00 Tim Northover <t.p.northover at gmail.com>: > >> On 1 December 2015 at 12:33, Xiangyang Guo via llvm-dev >> <llvm-dev at lists.llvm.org> wrote: >> > if I have the following IR, LICM doesn't work again, even if I use >> > '-loop-rotate' firstly. In this IR, the return value of intrinsic >> function >> > "foo" is used by another function "func2" as parameter. However, for >> the >> > intrinsic function "foo", the parameters are still loop invariant. Do >> you >> > know why this happens? Thanks a lot. >> >> Is there anything telling LLVM that func2 won't write to memory and >> change the value returned by llvm.foo? >> >> Cheers. >> >> Tim. >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151201/fa7a9884/attachment.html>
Xiangyang Guo via llvm-dev
2015-Dec-01 21:11 UTC
[llvm-dev] LICM doesn't work for IntrReadMem intrinsic function
Hi, Tim, I see your point. Only if I set the func2 to 'readonly', the llvm.foo can be loop invariant. Thanks. Regards, Xiangyang 2015-12-01 15:51 GMT-05:00 Tim Northover <t.p.northover at gmail.com>:> On 1 December 2015 at 12:33, Xiangyang Guo via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > if I have the following IR, LICM doesn't work again, even if I use > > '-loop-rotate' firstly. In this IR, the return value of intrinsic > function > > "foo" is used by another function "func2" as parameter. However, for the > > intrinsic function "foo", the parameters are still loop invariant. Do you > > know why this happens? Thanks a lot. > > Is there anything telling LLVM that func2 won't write to memory and > change the value returned by llvm.foo? > > Cheers. > > Tim. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151201/06d1876d/attachment.html>