public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/114331] Missed optimization: indicate knownbits from dominating condition switch(trunc(a))
Date: Thu, 14 Mar 2024 17:58:33 +0000	[thread overview]
Message-ID: <bug-114331-4-NEqAvev0bt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114331-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I really don't know how GORI etc. works.
But, if when the switch handling determines that _1 (the switch controlling
expression) has [irange] [111, 111] MASK 0x0 VALUE 0x6f (does it actually? i.e.
for a singleton range all the bits here are known and equal to the value), then
when trying to derive a range for related num_9(D) which is int rather than
_1's short and
  _1 = (short int) num_5(D);
for the MASK/VALUE we should just use the same VALUE and or in 0xffff0000 into
MASK because we then don't know anything about the upper bits.
Though, looking at the evrp detailed dump there is
2->3      _1 :  [irange] short int [111, 111]
2->3      _2 :  [irange] int [111, 111]
2->3      num_5(D) :    [irange] int [-INF, -65537][-65425, -65425][111,
111][65536, +INF]
and so no MASK/VALUE for any of those ranges.
Now, from comments it seems that irange_bitmask is only computed on demand to
speed things up, unless it has been explicitly set.
Now, say for _1 or _2 above, we don't have anything recorded but we can always
compute it on demand from the value range.  But when adding the num_5(D) range
based on the related _1 range, the on-demand irange_bitmask is no longer as
precise as it would be if we when deriving that [-INF, -65537][-65425,
-65425][111, 111][65536, +INF] range
from the [111, 111] range also derived from the in that case on-demand asked
MASK 0x0 VALUE 0x6f to MASK 0xffff0000 VALUE 0x6f.

  parent reply	other threads:[~2024-03-14 17:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14  5:50 [Bug tree-optimization/114331] New: " xxs_chy at outlook dot com
2024-03-14  8:36 ` [Bug tree-optimization/114331] " rguenth at gcc dot gnu.org
2024-03-14  8:44 ` jakub at gcc dot gnu.org
2024-03-14 12:45 ` amacleod at redhat dot com
2024-03-14 13:21 ` jakub at gcc dot gnu.org
2024-03-14 16:33 ` amacleod at redhat dot com
2024-03-14 16:57 ` aldyh at gcc dot gnu.org
2024-03-14 17:08 ` jakub at gcc dot gnu.org
2024-03-14 17:28 ` amacleod at redhat dot com
2024-03-14 17:39 ` pinskia at gcc dot gnu.org
2024-03-14 17:58 ` jakub at gcc dot gnu.org [this message]
2024-03-14 18:29 ` amacleod at redhat dot com
2024-03-14 18:41 ` jakub at gcc dot gnu.org
2024-03-15  7:51 ` aldyh at gcc dot gnu.org
2024-03-15  8:01 ` jakub at gcc dot gnu.org
2024-03-15  8:05 ` jakub 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-114331-4-NEqAvev0bt@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).