[llvm-dev] LICM doesn't work for IntrReadMem intrinsic function
Xiangyang Guo via llvm-dev
llvm-dev at lists.llvm.org
Tue Dec 1 10:16:09 PST 2015
Thanks for your reply, escha,
Yes, -loop-rorate makes it work.
2015-12-01 12:48 GMT-05:00 <escha at apple.com>:
> > On Dec 1, 2015, at 9:30 AM, Xiangyang Guo via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
> > Hi, All,
> > Suppose I define one memory read only intrinsic function "foo" in
> Intrinsics.td like this
> > def int_foo : Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
> > 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.
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev