LNO optimizing out operations it shouldn't?

Timothy J.Wood tjw@omnigroup.com
Fri Jun 18 03:26:00 GMT 2004



   I just built up LNO for the first time last night and was surprised 
at its behavior with a simple example (based on one of the 
tree-ssa-vect tests):


#define VECTOR_SIZE 512

typedef float afloat __attribute__ ((__aligned__(16)));

extern void check(const afloat * __restrict__ x, const afloat * 
__restrict__ y, const afloat * __restrict__ out);

void mul(const afloat * __restrict__ x, const afloat * __restrict__ y, 
afloat * __restrict__ out)
{
     unsigned int i;
     for (i = 0; i < VECTOR_SIZE; i++)
	out[i] = x[i] * y[i];
     //check(x,y,out);
}


   build with:

$PREFIX/bin/gcc -O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec 
-S test.c  -o test.s

   I get the following on Darwin:

.text
	.align 2
	.align 2
	.globl _mul
_mul:
	li r0,128
	mtctr r0
L2:
	bdnz L2
	blr

   If I remove the comment on the call to 'check', real code to do the 
'*' gets emitted.  This seems like a pretty obvious case, and in fact I 
see that tree-ssa-vect-1.c has this same sort of 'call to non-existant' 
function (and of course many of the other test have checking to verify 
the results...).

   This this seems obvious, but I don't see anything in bugzilla.

-tim



More information about the Gcc mailing list