]> gcc.gnu.org Git - gcc.git/commit
Drop overflow from constants while building ranges in ranger.
authorAldy Hernandez <aldyh@redhat.com>
Thu, 5 Nov 2020 11:40:51 +0000 (12:40 +0100)
committerAldy Hernandez <aldyh@redhat.com>
Thu, 5 Nov 2020 16:16:20 +0000 (17:16 +0100)
commit4ef0f1e90f1795b1f2d5bba05ed299e8c7635fd4
tree58762b264edd47e2aa29482a9ee160b1da91a307
parentf8cc59ef4941c19d068b9dfe4e13753c9fd402c6
Drop overflow from constants while building ranges in ranger.

Sometimes the overflow flag will leak into the IL.  Drop it while
creating ranges.

There are various places we could plug this.  This patch just plugs things
at get_tree_range which is the entry point for ranges from tree expressions.
It fixes the PR, and probably fixes the ranger entirely, but we may need
to revisit this.

For example, I looked to see if there were other places that created
ranges with TREE_OVERFLOW set, and there are various.  For example,
the following code pattern appears multiple times in vr-values.c:

  else if (is_gimple_min_invariant (op0))
    vr0.set (op0);

This can pick up TREE_OVERFLOW from the IL if present.  However, the
ranger won't see them so we're good.

At some point we should audit all this.  Or perhaps just nuke all
TREE_OVERFLOW's at irange::set.

For now, this will do.

gcc/ChangeLog:

PR tree-optimization/97721
* gimple-range.cc (get_tree_range): Drop overflow from constants.

gcc/testsuite/ChangeLog:

* gcc.dg/pr97721.c: New test.
gcc/gimple-range.cc
gcc/testsuite/gcc.dg/pr97721.c [new file with mode: 0644]
This page took 0.069588 seconds and 5 git commands to generate.