> On 21 Nov 2017, at 16:43, Kilian Verhetsel <kilian.verhet...@uclouvain.be> > wrote: > > >> This is PR81179 I think, please mention that in the changelog. > > Correct, my bad for missing that. > >> This unconditionally pessimizes code even if there is no valid index >> zero, right? > > Almost, since for a loop such as: > > #define OFFSET 1 > unsigned int find(const unsigned int *a, unsigned int v) { > unsigned int result = 120; > for (unsigned int i = OFFSET; i < 32+OFFSET; i++) { > if (a[i-OFFSET] == v) result = i; > } > return result; > } > > the index i will match the contents of the index vector used here --- > but this does indeed pessimize the code generated for, say, OFFSET > = 2. It is probably more sensible to use the existing code path in those > situations. >
Looking at the final asm on aarch64 for -14.c, the code has only grown By a single instruction in the epilogue. Which is good, given the vector pass dump for this patch is quite a bit longer. In the vector dump, there is a vector of 0’s _57 = { 0, 0, 0, 0 }; created which is then never used (and later gets optimised away). Be nice if that could avoid getting created. I’ve not had chance to scrutinise the patch yet to see where that is created. >> The issue with the COND_REDUCITION index vector is overflow IIRC. > > Does that mean such overflows can already manifest themselves for > regular COND_REDUCTION? I had assumed sufficient checks were already in > place because of the presence of the is_nonwrapping_integer_induction > test. As an aside, it’s possibly worth mentioning that this issue will go away for aarch64-sve when Richard Sandiford’s SVE patch goes in, as that’ll support CLASTB reduction.