On Thu, Nov 27, 2025 at 9:23 PM Paul Koning <[email protected]> wrote:
>
>
>
> > On Nov 27, 2025, at 8:16 AM, Jakub Jelinek <[email protected]> wrote:
> >
> > On Thu, Nov 27, 2025 at 09:02:20PM +0800, Dongyan Chen wrote:
> >> This patch implements an optimization to transform (a * b) == 0 to
> >> (a == 0) || (b == 0) for signed and unsigned integer.
> >
> > Shouldn't that just optimize to (a | b) == 0
> > instead?  At least when a and b have the same type.
>
> I would think that (a==0) || (b==0) would optimize already to (a|b)==0 
> provided b has no side effects.

I'd consider (a==0) || (b==0) less simple on GIMPLE than (a*b) == 0 because the
former has three operations while the latter has two.  Thus I prefer
a|b == 0 which
at least has the same number of operations.

>         paul
>

Reply via email to