On Thu, Nov 10, 2011 at 10:58:36PM -0700, Jeff Law wrote: > > This patch attempts to optimize VEC_BASE if we know that offsetof > > of base is 0 (unless the compiler is doing something strange, it is > > true). It doesn't have a clear code size effect, some .text > > sections grew, supposedly because of more inlining, some .text > > sections shrunk. > > > > Bootstrapped/regtested on x86_64-linux and i686-linux. > > > > 2011-11-07 Jakub Jelinek <ja...@redhat.com> > > > > * vec.h (VEC_BASE): If base is at offset 0 in the structure, use > > &(P)->base even if P is NULL. > Presumably this becomes redundant with we went with Richi's patch?
I've actually committed it yesterday after discussion with Richi on IRC. While his patch optimizes it, it doesn't do so for -O0 and isn't performed during the early passes. For -O0 the offsetof == 0 should be folded to 1 and the test should be eliminated and for -O1+ it may affect inlining decisions. Jakub