This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] fix iv creation in vectorizer


Hello,

> The problem here is that the vectorizer is creating induction variables
> of the form "base + count * vector_size", where base is a pointer, and
> count is an "int".  So on 64-bit targets it gets sign-extended before
> the addition, which pretty much destroys the loop optimization.  In some
> cases the loop optimizer seems to figure it out and fix it, but most of
> the time not.
> 
> There are a couple of ways this could be solved:
> 
> (1) Minimum change is in vect_create_index_for_vector_ref; use 
>     size_zero/one_node instead of integer_zero/one_node.
> 
> (2) Avoid creating N loop counters, and reuse a canonical loop counter
>     variable.  I didn't immediately see a good place off which to hang
>     such a thing.  Perhaps this should still be revisited.
> 
> (3) Create pointer induction variables instead of futzing around with
>     integers and multiplication.  Like, you know, real people might
>     write by hand.
> 
> (4) A form of (3) could still be combined with (2), in that if you've
>     got "t1 = *p; t2 = t1 + 1; *p = t2", we'll create two induction
>     variables for the two uses of *p.  Which does get cleaned up later,
>     but it seems wasteful to create in the first place.
> 
> I chose option 3.  Anyone have any opinions on whether 2 might have
> been better?

I also think 3) is the best one.

> Diego, why did I have to add the call to merge_alias_info here?  Why
> does it seem to be needed now, and it wasn't before?
> 
> Oh, and I also purged the vectorizer of all references to
> integer_type_node or unsigned_type_node.  I'm thinking perhaps we
> ought to poison these and other suspect identifiers in the tree
> optimizers.

This might be a good idea.  I am fairly sure there are some illegitimate
uses left in hard-to-test parts of scev.

Zdenek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]