[LLVMdev] Disable loop unroll pass

Eli Friedman eli.friedman at gmail.com
Wed Nov 21 18:40:15 PST 2012


On Wed, Nov 21, 2012 at 2:07 PM, Ivan Llopard <ivanllopard at gmail.com> wrote:
> Hi Brendon, Krzysztof,
>
> Thanks for your responses.
>
>
> On 21/11/2012 20:49, Brendon Cahoon wrote:
>>
>> I just wanted to add to Krzysztof's response.   I'm not sure if you're
>> referring to the case when a compile-time trip count loop is completely
>> unrolled or for a loop with a run-time trip count, which would be
>> partially
>> unrolled.  For Hexagon, if we partially unroll a loop, we'd also like to
>> use
>> our hardware loop instructions.  That is, unrolling and hardware loops are
>> complementary.
>
>
> Not sure if they are completely complementaries. What about static trip
> counts? It is always profitable to use hardware loops for them. My question
> is: are the estimations to trigger loop unrolling realistic in presence of
> zero-cost loops?
>
> Given that loops get unrolled if the user is not looking for optimizing the
> code size but wants faster code instead, hardware loops meet both
> conditions, size and speed. In addition, they are always discovered for
> static trip counts.

Even if hardware loops are zero-cost, it doesn't mean we should never
unroll loops.  It just means loop unrolling should be less aggressive,
because avoiding loop iterations isn't itself a performance benefit.
Our current loop unrolling pass doesn't have appropriate heuristics to
detect that, but it's worth keeping in mind while planning the
appropriate interface.

-Eli



More information about the llvm-dev mailing list