public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-5630] Ranger cache - always use range_from_dom when updating.
@ 2023-02-01 14:27 Andrew Macleod
0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2023-02-01 14:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:881bf8de9b07fb501d61ade8f521f1cc9dbe712e
commit r13-5630-g881bf8de9b07fb501d61ade8f521f1cc9dbe712e
Author: Andrew MacLeod <amacleod@redhat.com>
Date: Tue Jan 10 13:40:56 2023 -0500
Ranger cache - always use range_from_dom when updating.
When updating an existing range, if we dont query the dom tree, we can
get the global range instead of a proper range on some incoming edges
which cause the range to not be refined properly.
PR tree-optimization/108356
gcc/
* gimple-range-cache.cc (ranger_cache::range_on_edge): Always
do a search of the DOM tree for a range.
gcc/testsuite/
* gcc.dg/pr108356.c: New.
Diff:
---
gcc/gimple-range-cache.cc | 2 +-
gcc/testsuite/gcc.dg/pr108356.c | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc
index a8202f0e895..20c444bc4f4 100644
--- a/gcc/gimple-range-cache.cc
+++ b/gcc/gimple-range-cache.cc
@@ -998,7 +998,7 @@ bool
ranger_cache::range_on_edge (vrange &r, edge e, tree expr)
{
if (gimple_range_ssa_p (expr))
- return edge_range (r, e, expr, RFD_NONE);
+ return edge_range (r, e, expr, RFD_READ_ONLY);
return get_tree_range (r, expr, NULL);
}
diff --git a/gcc/testsuite/gcc.dg/pr108356.c b/gcc/testsuite/gcc.dg/pr108356.c
new file mode 100644
index 00000000000..1df6b278e45
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr108356.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+char a;
+static char c = 3;
+char d;
+void foo();
+short(b)(short e, short f) { return e + f; }
+int main() {
+ unsigned g = 0;
+ if (c)
+ ;
+ else
+ foo();
+ for (; g < 2; g = b(g, 2)) {
+ d = g ? 0 : a;
+ if (g)
+ c = 0;
+ }
+}
+
+
+/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-01 14:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-01 14:27 [gcc r13-5630] Ranger cache - always use range_from_dom when updating Andrew Macleod
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).