On Tue, 15 Mar 2022, Roger Sayle wrote:

>  
> 
> This patch improves the implementation of single_use as used in code
> 
> generated from match.pd for patterns using :s.  The current implementation
> 
> contains the logic "has_zero_uses (t) || has_single_use (t)" which
> 
> performs a loop over the uses to first check if there are zero non-debug
> 
> uses [which is rare], then another loop over these uses to check if there
> 
> is exactly one non-debug use.  This can be better implemented using a
> 
> single loop.
> 
>  
> 
> This function is currently inlined over 800 times in gimple-match.cc,
> 
> whose .o on x86_64-pc-linux-gnu is now up to 30 Mbytes, so speeding up
> 
> and shrinking this function should help offset the growth in match.pd
> 
> for GCC 12.
> 
>  
> 
> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> 
> and make -k check with no new failures.  Ok for mainline?

Note the intent of has_zero_uses () is even simpler - it's the case
for when there's no SSA operand info on the stmt (no update_stmt called
yet).  More precisely it wants to catch the case where the definition
of the SSA name is not in the IL.

I'm not sure if we want to twist the effective semantics at this
point (I guess we do not want that), so the patch looks like an
improvement.  But may I ask to move the function out of line for
even more savings?  Just put it in gimple-match-head.cc and have it
not declared inline.  I think we may want to go as far and
declare the function 'pure' using ATTRIBUTE_PURE.

>  
> 
>  
> 
> 2022-03-15  Roger Sayle  <ro...@nextmovesoftware.com>
> 
>  
> 
> gcc/ChangeLog
> 
> * gimple-match-head.cc (single_use): Implement inline using a
> 
> single loop.
> 
>  
> 
> Thanks in advance,
> 
> Roger
> 
> --
> 
>  
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Ivo Totev; HRB 36809 (AG Nuernberg)

Reply via email to