This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Ping: [patch] Fix PR22372
On Wed, Aug 10, 2005 at 03:05:19PM +0300, Ira Rosen wrote:
> http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01877.html
Not ok.
First,
! if (TREE_TYPE (vec_oprnd1) != vectype)
Never use direct pointer comparison. Always use the
lang_hook.type_compatible_p function.
Second,
! build1 (NOP_EXPR, vectype, vec_oprnd1));
Never build NOP_EXPRs yourself. Use fold_convert.
Third, none of this would have been necessary if you'd had
formed the address correctly in the first place. From the
test case, the current source creates
char * vect_pib.35;
vector char * vect_pib.32;
vect_pib.35_45 = &ib;
vect_pib.32_51 = (vector char *) vect_pib.35_45;
your patched source creates
char[16] * vect_pib.35;
vector char * vect_pib.32;
vect_pib.35_45 = &ib;
vect_pib.32_51 = (vector char *) vect_pib.35_45;
and an ideal result would be either
vector char * vect_pib.32;
vect_pib.32_51 = (vector char *) &ib;
or
vect_pib.32_51 = (vector char *) &ib[0];
eliminating the vect_pib.35 variable entirely.
If this is too difficult, I'd prefer emitting
char * vect_pib.35;
vector char * vect_pib.32;
vect_pib.35_45 = &ib[0];
vect_pib.32_51 = (vector char *) vect_pib.35_45;
over your current patch.
r~