This avoids one strip_offset use in add_iv_candidate_for_use where
we know it operates on a sizetype quantity.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

        * tree-ssa-loop-ivopts.cc (add_iv_candidate_for_use): Use
        split_constant_offset for the POINTER_PLUS_EXPR case.
---
 gcc/tree-ssa-loop-ivopts.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc
index 65caf382bba..03161813e0a 100644
--- a/gcc/tree-ssa-loop-ivopts.cc
+++ b/gcc/tree-ssa-loop-ivopts.cc
@@ -3588,8 +3588,9 @@ add_iv_candidate_for_use (struct ivopts_data *data, 
struct iv_use *use)
       step = fold_convert (sizetype, step);
       record_common_cand (data, base, step, use);
       /* Also record common candidate with offset stripped.  */
-      tree alt_base = strip_offset (base);
-      if (alt_base != base)
+      tree alt_base, alt_offset;
+      split_constant_offset (base, &alt_base, &alt_offset);
+      if (!integer_zerop (alt_offset))
        record_common_cand (data, alt_base, step, use);
     }
 
-- 
2.35.3

Reply via email to