[patch] Fix PR tree-optimization/49318

Ira Rosen ira.rosen@linaro.org
Fri Jun 10 11:37:00 GMT 2011

On 10 June 2011 12:14, Richard Guenther <richard.guenther@gmail.com> wrote:
> On Fri, Jun 10, 2011 at 9:19 AM, Ira Rosen <ira.rosen@linaro.org> wrote:
>> Hi,
>> The test in PR 49318 fails because the vectorizer recognizes address
>> computation sequence as a widening-multiplication pattern, while such
>> sequence is not relevant to vectorization. The problem is that the
>> vectorizer doesn't check if a statement is going to be vectorized
>> before replacing it with a pattern. Moreover, the vectorizer first
>> detects the patterns and only after that looks for relevant
>> statements. Changing the order is not a good option, since statements
>> relevance is defined also by their belonging to a pattern.
>> This patch solves the problem by removing pattern statements that were
>> created for statements that are not supposed to be vectorized.
>> Bootstrapped with vectorization enabled on powerpc64-suse-linux and
>> tested on powerpc64-suse-linux and x86_64-suse-linux.
>> Committed.
> Ick, yeah.  I remember running into this ordering issue when doing the
> multi-vector size reorgs...
> In the end I think we should not generate the pattern stmt during
> pattern matching but only mark the relevant statements with a
> pattern kind.  Say, for each pattern we have a "main" statement
> that has related stmts belonging to the pattern that define uses
> of the "main" statement - mark those to refer to that "main" statement.
> For that "main" statement simply record an enum value, like,
> widening_mult.  Then only at vectorized statement
> generation time actually generate the vectorized form of the
> pattern statement.
> Thus, the non-vectorized pattern statements would never be generated.
> So, separate analysis and transform more properly.
> Of course I didn't get around to implement the above ... (we'd have
> a new vectorizable_pattern worker).

Sounds like a good idea. I'll give it a try.


> Richard.
>> Ira
>> ChangeLog:
>>     PR tree-optimization/49318
>>     * tree-vect-loop.c (vect_determine_vectorization_factor):
>>     Remove irrelevant pattern statements.
>> testsuite/ChangeLog:
>>     PR tree-optimization/49318
>>     * gcc.dg/vect/pr49318.c: New test.

More information about the Gcc-patches mailing list