[llvm] r190936 - Prevent LoopVectorizer and SLPVectorizer running if the target has no vector registers.

Robert Lytton robert at xmos.com
Wed Sep 18 07:24:35 PDT 2013


Hi Tobias,

I was unaware of the discussion but have now reviewed the thread r189281.
As the xcore architecture does not support Out-of-Order execution (nor vectorization), any such loop unrolling is potentially (usually) harmful.
For us, loop-unroll heuristics need to be balanced against code size (we currently use a #pragma to explicitly control it).

Are there targets with no vector registers, where OoO is supported and as such a partial unroll would be beneficial?
Do we need an new flag to control this feature independently? 

Robert

________________________________________
From: Tobias Grosser [tobias at grosser.es]
Sent: 18 September 2013 14:00
To: Robert Lytton
Cc: llvm-commits at cs.uiuc.edu; Nadav Rotem; Eric Christopher
Subject: Re: [llvm] r190936 - Prevent LoopVectorizer and SLPVectorizer running if the target has no vector registers.

On 09/18/2013 02:43 PM, Robert Lytton wrote:
> Author: rlytton
> Date: Wed Sep 18 07:43:35 2013
> New Revision: 190936
>
> URL: http://llvm.org/viewvc/llvm-project?rev=190936&view=rev
> Log:
> Prevent LoopVectorizer and SLPVectorizer running if the target has no vector registers.
>
> XCore target: Add XCoreTargetTransformInfo
> This is where getNumberOfRegisters() resides, which in turn returns the
> number of vector registers (=0).

Hi Robert,

your patch may prevent partial loop unrolling as performed by the loop
vectorizer.

Some history:

In commit 'r189281 - LoopVectorize: Implement partial loop unrolling
when vectorization is not profitable.' Nadav implemented partial loop
unrolling as part of the Loop Vectorizer. I am unsure if partial loop
unrolling might still be useful/beneficial for targets without vector
registers. However, in case it is, your current patch prevents it on
such targets.

At the time Nadav's patch was committed there was some discussion if
doing unrolling within the vectorizer may cause misunderstandings due to
the fact that a vectorizer now does more than just vectorization. Is
your commit based on such a misunderstanding or does e.g. the XCore
target not benefit from partial loop unrolling?

Cheers,
Tobias




More information about the llvm-commits mailing list