[PATCH] tree-optimization: [PR102622]: wrong code due to signed one bit integer and "a?-1:0"

Michael Matz matz@suse.de
Mon Oct 11 13:07:17 GMT 2021


Hello,

On Sat, 9 Oct 2021, apinski--- via Gcc-patches wrote:

> +      (lshift (convert (convert:boolean_type_node @0)) { shift; })))
> +    /* a ? -1 : 0 -> -a.  No need to check the TYPE_PRECISION not being 1
> +       here as the powerof2cst case above will handle that case correctly.  */

Well, but the QoI will improve quite a bit when you just do the check, 
instead of relying on order of patterns.  It's not slow or harmful to 
check and will make the order irrelevant, which, given the number of 
patterns we already have, is a good thing.  (It will also be smaller to 
check than to document why the check isn't needed :-) )


Ciao,
Michael.


More information about the Gcc-patches mailing list