[Mesa-dev] [PATCH] i965: Trim
Chris Wilson
chris at chris-wilson.co.uk
Wed Feb 7 20:51:25 UTC 2018
Quoting Matt Turner (2018-02-07 20:42:15)
> On Wed, Feb 7, 2018 at 11:41 AM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > text data bss dec hex filename
> > 8852169 388752 671064 9911985 973eb1 lib/i965_dri.so
> > 8852017 388752 671064 9911833 973e19
> > ---
> > src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 48 +++++++++-----------------
> > 1 file changed, 16 insertions(+), 32 deletions(-)
> >
> > diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> > index 53a5679691..a8157b5232 100644
> > --- a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> > +++ b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> > @@ -468,26 +468,22 @@ linear_to_xtiled_faster(uint32_t x0, uint32_t x1, uint32_t x2, uint32_t x3,
> > if (mem_copy == memcpy)
> > return linear_to_xtiled(0, 0, xtile_width, xtile_width, 0, xtile_height,
> > dst, src, src_pitch, swizzle_bit, memcpy, memcpy);
> > - else if (mem_copy == rgba8_copy)
> > + else /* if (mem_copy == rgba8_copy) */
> > return linear_to_xtiled(0, 0, xtile_width, xtile_width, 0, xtile_height,
> > dst, src, src_pitch, swizzle_bit,
> > rgba8_copy, rgba8_copy_aligned_dst);
> > - else
> > - unreachable("not reached");
> > } else {
> > if (mem_copy == memcpy)
> > return linear_to_xtiled(x0, x1, x2, x3, y0, y1,
> > dst, src, src_pitch, swizzle_bit,
> > memcpy, memcpy);
> > - else if (mem_copy == rgba8_copy)
> > + else /* if (mem_copy == rgba8_copy) */
> > return linear_to_xtiled(x0, x1, x2, x3, y0, y1,
> > dst, src, src_pitch, swizzle_bit,
> > rgba8_copy, rgba8_copy_aligned_dst);
> > - else
> > - unreachable("not reached");
>
> This should be a no-op. I'd expect the presence of 'else unreachable'
> to allow the compiler to remove the previous conditional.
>
> > }
> > - linear_to_xtiled(x0, x1, x2, x3, y0, y1,
> > - dst, src, src_pitch, swizzle_bit, mem_copy, mem_copy);
> > +
> > + unreachable("not reached");
>
> I would expect this is what causes the change. If that's the case,
> let's just make this change. What do you think?
Don't mind, I didn't really mean to send this patch (pointed git at the
wrong branch). I was a bit surprised that the compiler treated it any
differently as all branches were terminated by unreachable, and the text
reduction is not enough to account for a linear_to_xtiled() expansion
(they're all meant to be unique expansions aiui).
From a reading pov, having a linear_to_*tiled() after a set of
terminated branches does look a bit odd, so replacing it with an
unreachable() is a good idea.
-Chris
More information about the mesa-dev
mailing list