[llvm-dev] Why does LLVM keep some loads in the loops even after applying the O3 optimization?

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 28 07:30:35 PDT 2019


Hi Fami,


On Thu, 28 Mar 2019 at 14:17, Fami H via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> There are no other basic blocks in the loop.  I am wondering why the first load instruction (ldr r0, [r5]) is repeatedly executed in the loop while the load address (r5) is never changed in the loop body. Shouldn't this instruction be moved out of the loop as a result of -licm flag?

It's very difficult to say without the source. It's possible LLVM
thinks the fprintf call might modify memory at that address, but
that's only speculation.

Cheers.

Tim.


More information about the llvm-dev mailing list