On 2017-09-28 18:39:03 -0400, Tom Lane wrote:
> Andres Freund <and...@anarazel.de> writes:
> > On 2017-09-28 16:21:34 -0400, Tom Lane wrote:
> >> We could save a pointless register spill
> >> and reload if there were a temporary variable in there,
> 
> > Makes sense.  Do you want to make it so, or shall I?
> 
> I just finished testing a patch, as attached.  On my machine (again,
> not latest gcc: 4.4.7 on RHEL6 x86_64), it reduces the code size of
> execExprInterp.o by a fraction of a percent, and it seems to offer
> a slight benefit in "pgbench -S" performance although I'd not put
> much stock in that being reproducible.

Cool.

> +              * Note: the reason for using a temporary variable "d", here 
> and in
> +              * other places, is that some compilers think "*op->resvalue = 
> f();"
> +              * requires them to evaluate op->resvalue into a register before
> +              * calling f(), just in case f() is able to modify op->resvalue
> +              * somehow.  The extra line of code can save a useless register 
> spill
> +              * and reload, on architectures without many registers.

I'd remove the "without many registers" bit - that's really more an
functioncall ABI question (#caller vs #callee saved registers) than
about the actual architecture.

Greetings,

Andres Freund


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to