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/107608] [13 Regression] Failure on fold-overflow-1.c and pr95115.c
Date: Tue, 10 Jan 2023 14:40:48 +0000	[thread overview]
Message-ID: <bug-107608-4-nDpI3jQsHJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107608-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #24 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Andrew Macleod from comment #21)
> (In reply to Richard Biener from comment #13)
> 
> > Yes, the fact that ranger doesn't operate as a usual propagator with a
> > lattice
> > makes things very difficult here.  Note that my comment referred to code
> > optimality, not correctness.
> > 
> > > It really looks like the problem here is DCE (and the gimplifier as you
> > > point out in comment #2), which is removing a needed statement.  Can't this
> > > be fixed there?
> > 
> > Sure it can, but the expense is that we'd do constant folding all the way
> > down and not remove dead code which will result in _tons_ of unnecessary
> > constant pool entries and loads.
> > 
> 
> I think I'm missing something, or not understanding what you are saying.
> 
> Why is the propagation or lack of lattice a problem?   Its DCE that is
> removing that potentially trapping stmt because its no longer used in the
> IL?  THe change would be to not kill off dead statements that may trap?  I
> guess this may leave a bunch of feeding statements that are not dead.. but I
> fail to see how thats different than not propagating and then not being able
> to delete those stmts either?  
> 
> 
> > The issue is also that -ftrapping-math is default on so we'd have to
> > do this by default.  Ugh.
> > 
> > Note that the constant folding routines generally refrain from folding
> > when that loses exceptions, it's just ranger when producing singleton
> > ranges and propagating from them that doesn't adhere to that implicit rule.
> 
> I'm also not sure what this means.  I don't think ranger itself propagates
> singleton constants.. VRP is still using the substitute_and_fold engine, so
> any folding/propagation is still going through the same mechanisms we always
> did when a singleton result is produced.  We just produce more of them now,
> especially with floats.  I don't think ranger is doing anything different
> than VRP ever did regarding propagation.   Its possible GCCs infrastructure
> for dealing with float propagation isn't mature enough perhaps?

Right, ranger isn't propagating anything.  It's the substitute_and_fold engine,
as it always has, but only if value_of_expr() is non-NULL.  Currently this
function will only return non-NULL for singletons:

tree
range_query::value_of_expr (tree expr, gimple *stmt)
{
  tree t;

  if (!Value_Range::supports_type_p (TREE_TYPE (expr)))
    return NULL_TREE;

  Value_Range r (TREE_TYPE (expr));

  if (range_of_expr (r, expr, stmt))
    {
      // A constant used in an unreachable block oftens returns as UNDEFINED.
      // If the result is undefined, check the global value for a constant.
      if (r.undefined_p ())
        range_of_expr (r, expr);
      if (r.singleton_p (&t))
        return t;
    }
  return NULL_TREE;
}

  parent reply	other threads:[~2023-01-10 14:40 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10  9:47 [Bug tree-optimization/107608] New: [13 Regression] Failure on fold-overflow-1.c jakub at gcc dot gnu.org
2022-11-10  9:49 ` [Bug tree-optimization/107608] " jakub at gcc dot gnu.org
2022-11-10 13:47 ` rguenth at gcc dot gnu.org
2022-11-10 18:13 ` pinskia at gcc dot gnu.org
2022-11-11  7:18 ` pinskia at gcc dot gnu.org
2022-11-13  6:30 ` [Bug tree-optimization/107608] [13 Regression] Failure on fold-overflow-1.c and pr95115.c xry111 at gcc dot gnu.org
2022-11-28 10:06 ` rguenth at gcc dot gnu.org
2022-12-05 13:22 ` aldyh at gcc dot gnu.org
2022-12-05 15:14 ` rguenth at gcc dot gnu.org
2022-12-05 16:30 ` aldyh at gcc dot gnu.org
2022-12-16 13:20 ` jakub at gcc dot gnu.org
2022-12-16 13:32 ` rguenth at gcc dot gnu.org
2023-01-09 15:18 ` aldyh at gcc dot gnu.org
2023-01-10  8:56 ` rguenth at gcc dot gnu.org
2023-01-10  8:58 ` rguenth at gcc dot gnu.org
2023-01-10 10:20 ` aldyh at gcc dot gnu.org
2023-01-10 10:25 ` aldyh at gcc dot gnu.org
2023-01-10 11:00 ` rguenth at gcc dot gnu.org
2023-01-10 11:09 ` jakub at gcc dot gnu.org
2023-01-10 12:08 ` rguenther at suse dot de
2023-01-10 14:14 ` jakub at gcc dot gnu.org
2023-01-10 14:25 ` amacleod at redhat dot com
2023-01-10 14:33 ` aldyh at gcc dot gnu.org
2023-01-10 14:39 ` jakub at gcc dot gnu.org
2023-01-10 14:40 ` aldyh at gcc dot gnu.org [this message]
2023-01-10 14:42 ` jakub at gcc dot gnu.org
2023-01-12 11:42 ` aldyh at gcc dot gnu.org
2023-01-12 12:03 ` jakub at gcc dot gnu.org
2023-01-12 12:26 ` xry111 at gcc dot gnu.org
2023-01-13 13:19 ` aldyh at gcc dot gnu.org
2023-01-13 13:25 ` aldyh at gcc dot gnu.org
2023-01-15 15:43 ` cvs-commit at gcc dot gnu.org
2023-01-16 21:38 ` romain.geissler at amadeus dot com
2023-01-16 21:46 ` jakub at gcc dot gnu.org
2023-01-16 21:55 ` romain.geissler at amadeus dot com
2023-01-16 21:58 ` fw at gcc dot gnu.org
2023-01-18 12:26 ` aldyh at gcc dot gnu.org
2023-01-18 12:54 ` jakub at gcc dot gnu.org
2023-01-18 12:56 ` aldyh at gcc dot gnu.org
2023-01-18 13:00 ` rguenth at gcc dot gnu.org
2023-01-18 13:03 ` rguenth at gcc dot gnu.org
2023-01-18 13:05 ` rguenth at gcc dot gnu.org
2023-01-19  1:15 ` xry111 at gcc dot gnu.org
2023-01-19  7:17 ` rguenther at suse dot de
2023-01-26 14:29 ` xry111 at gcc dot gnu.org
2023-01-27  7:35 ` rguenth at gcc dot gnu.org
2023-01-27  7:59 ` xry111 at gcc dot gnu.org
2023-01-27  9:53 ` rguenther at suse dot de
2023-01-27 10:02 ` xry111 at gcc dot gnu.org
2023-01-27 10:13 ` jakub at gcc dot gnu.org
2023-01-27 11:30 ` rguenther at suse dot de

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-107608-4-nDpI3jQsHJ@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).