public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/55157] Missed VRP with != 0 and multiply
Date: Fri, 04 Nov 2022 19:45:06 +0000	[thread overview]
Message-ID: <bug-55157-4-MwEs0PrEiq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55157-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55157

--- Comment #9 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Aldy Hernandez from comment #7)
> (In reply to Andrew Macleod from comment #6)
> > (In reply to Aldy Hernandez from comment #4)

> > 3) It also seems to me that you then only need to add the zero/union iff the
> > trailing bit has zeros. ie, if the are no trailing zeros, then just set the
> > lb to 0, and calculate the UB based on the clz.
> 
> That actually made it slightly worse.

I did some more testing.  Your suggestions actually improved the original code
from 3.3% to 2.5%, but I added:

+  if (!wi::neg_p (mask, TYPE_SIGN (type ())) && prec > 1)

instead of:

+  if (TYPE_UNSIGNED (type ()) && prec > 1)

because we can still perform the optimization for signed positive numbers.  And
that brought the slowdown back to 3.6%.  But ISTM that we're gonna do it, might
as well do it for signed numbers as well.

Hmmmm... I think we really should do our best to represent masks as ranges as
it makes other optimizations possible across the ranger ecosystem.  But I'm not
ecstatic about the 3.6% drop (even though overall compilation is unaffected).

  parent reply	other threads:[~2022-11-04 19:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 21:51 [Bug tree-optimization/55157] New: Missing VRP pinskia at gcc dot gnu.org
2021-12-25 23:35 ` [Bug tree-optimization/55157] Missed VRP with != 0 and multiply pinskia at gcc dot gnu.org
2022-11-04 11:22 ` aldyh at gcc dot gnu.org
2022-11-04 11:39 ` aldyh at gcc dot gnu.org
2022-11-04 13:40 ` amacleod at redhat dot com
2022-11-04 15:44 ` aldyh at gcc dot gnu.org
2022-11-04 15:46 ` aldyh at gcc dot gnu.org
2022-11-04 19:45 ` aldyh at gcc dot gnu.org [this message]
2022-11-04 19:48 ` aldyh at gcc dot gnu.org
2022-11-04 20:03 ` aldyh at gcc dot gnu.org
2022-11-05  9:04 ` aldyh at gcc dot gnu.org
2022-11-07 19:59 ` cvs-commit at gcc dot gnu.org
2022-11-07 20:02 ` aldyh at gcc dot gnu.org
2022-11-08 18:26 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-55157-4-MwEs0PrEiq@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).