[PATCH] Loop Strength Reduce: Scaling factor cost.

Quentin Colombet qcolombet at apple.com
Fri May 31 11:11:39 PDT 2013


Hi,

Scaling factor are often used within loops to access cells of an array.
When applying a scaling factor is not free, the scaling factor should be part of the induction variable, i.e., hoisted outside the loop.

I have attached a patch that accounts for the cost of scaling factor in Loop Strength Reduce when rating the formulae (with the proper target hook).

The default implementation of the hook is: if the addressing mode is legal, the scaling factor is free.
This keeps the current behavior of LSR. We can then improve this, target by target, by overloading the target hook accordingly.

Thanks for the review,

-Quentin

PS: No test case as the old behavior is preserved.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130531/5001eecc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lsr_with_scale_cost.svndiff
Type: application/octet-stream
Size: 8859 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130531/5001eecc/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130531/5001eecc/attachment-0001.html>


More information about the llvm-commits mailing list