public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2013] Hide IVOPTs strip_offset
@ 2023-06-21 12:01 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-06-21 12:01 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fb0447b1f6b7373f57cb3a3d17a46803cfd9909d

commit r14-2013-gfb0447b1f6b7373f57cb3a3d17a46803cfd9909d
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jun 21 11:12:36 2023 +0200

    Hide IVOPTs strip_offset
    
    PR110243 shows strip_offset has some correctness issues, the following
    avoids using it from loop distribution which can use the more correct
    split_constant_offset from data-ref analysis instead.  The patch then
    un-exports the function from IVOPTs.
    
            * tree-loop-distribution.cc (classify_builtin_st): Use
            split_constant_offset.
            * tree-ssa-loop-ivopts.h (strip_offset): Remove.
            * tree-ssa-loop-ivopts.cc (strip_offset): Make static.

Diff:
---
 gcc/tree-loop-distribution.cc | 9 +++++----
 gcc/tree-ssa-loop-ivopts.cc   | 5 ++++-
 gcc/tree-ssa-loop-ivopts.h    | 1 -
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/gcc/tree-loop-distribution.cc b/gcc/tree-loop-distribution.cc
index 6291f941a21..cf7c197aaf7 100644
--- a/gcc/tree-loop-distribution.cc
+++ b/gcc/tree-loop-distribution.cc
@@ -1756,11 +1756,12 @@ classify_builtin_st (loop_p loop, partition *partition, data_reference_p dr)
       return;
     }
 
-  poly_uint64 base_offset;
-  unsigned HOST_WIDE_INT const_base_offset;
-  tree base_base = strip_offset (base, &base_offset);
-  if (!base_offset.is_constant (&const_base_offset))
+  tree base_offset;
+  tree base_base;
+  split_constant_offset (base, &base_base, &base_offset);
+  if (!cst_and_fits_in_hwi (base_offset))
     return;
+  unsigned HOST_WIDE_INT const_base_offset = int_cst_value (base_offset);
 
   struct builtin_info *builtin;
   builtin = alloc_builtin (dr, NULL, base, NULL_TREE, size);
diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc
index 6fbd2d59318..82531f97b93 100644
--- a/gcc/tree-ssa-loop-ivopts.cc
+++ b/gcc/tree-ssa-loop-ivopts.cc
@@ -1175,6 +1175,9 @@ contain_complex_addr_expr (tree expr)
   return res;
 }
 
+static tree
+strip_offset (tree expr, poly_uint64_pod *offset);
+
 /* Allocates an induction variable with given initial value BASE and step STEP
    for loop LOOP.  NO_OVERFLOW implies the iv doesn't overflow.  */
 
@@ -2942,7 +2945,7 @@ strip_offset_1 (tree expr, bool inside_addr, bool top_compref,
 
 /* Strips constant offsets from EXPR and stores them to OFFSET.  */
 
-tree
+static tree
 strip_offset (tree expr, poly_uint64_pod *offset)
 {
   poly_int64 off;
diff --git a/gcc/tree-ssa-loop-ivopts.h b/gcc/tree-ssa-loop-ivopts.h
index 95148616e70..7a53ce47f10 100644
--- a/gcc/tree-ssa-loop-ivopts.h
+++ b/gcc/tree-ssa-loop-ivopts.h
@@ -28,7 +28,6 @@ extern void dump_cand (FILE *, struct iv_cand *);
 extern bool contains_abnormal_ssa_name_p (tree);
 extern class loop *outermost_invariant_loop_for_expr (class loop *, tree);
 extern bool expr_invariant_in_loop_p (class loop *, tree);
-extern tree strip_offset (tree, poly_uint64_pod *);
 bool may_be_nonaddressable_p (tree expr);
 void tree_ssa_iv_optimize (void);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-21 12:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-21 12:01 [gcc r14-2013] Hide IVOPTs strip_offset Richard Biener

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).