[llvm-dev] LICM doesn't work for IntrReadMem intrinsic function
via llvm-dev
llvm-dev at lists.llvm.org
Tue Dec 1 09:48:08 PST 2015
> 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], [IntrReadMem]>;
>
> 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.
—escha
More information about the llvm-dev
mailing list