[LLVMdev] LICM

Chris Lattner clattner at apple.com
Tue Oct 27 09:34:29 PDT 2009


On Oct 27, 2009, at 9:32 AM, Chris Lattner wrote:

>
> On Oct 27, 2009, at 9:26 AM, Nick Lewycky wrote:
>
>> 2009/10/27 Marc Brünink <marc at bruenink.de>
>> Hi all,
>>
>> I just noticed that LICM does not hoist/sink the following store  
>> out of the loop:
>>
>>        int array[20];
>>        int i;
>>        for (i = 0; i<100; i++) {
>>                array [0] = 0;
>>        }
>>
>> The getElementPtr instruction is hoisted out of the loop; the store  
>> is not. Did I miss something obvious? Bitcode file attached.
>> Generated using LLVM 2.5 and
>> llvm-gcc -c -emit-llvm test_loop.c  -o - | opt  -licm -o test.bc -f
>>
>> Thanks for the report. Since this still happens with LLVM at the  
>> top of SVN, I filed it as http://llvm.org/PR5319 . Please add  
>> yourself to the cc list there.
>
> This is expected behavior, you need to run loop rotate before licm  
> to get this.   This is completely eliminate at -O3.

So, while this is true, Nick has a good point in PR5319 that we're not  
catching this at O2 with a slightly more complex testcase.    LICM can  
definitely be improved here.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091027/17d6f309/attachment.html>


More information about the llvm-dev mailing list