[gcc r14-2015] Less strip_offset in IVOPTs

Richard Biener rguenth@gcc.gnu.org
Wed Jun 21 12:01:54 GMT 2023


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

commit r14-2015-gb54d0f29590d21991f519c5b70cc74e6309aa2f6
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jun 21 12:08:01 2023 +0200

    Less strip_offset in IVOPTs
    
    This avoids one strip_offset use in add_iv_candidate_for_use where
    we know it operates on a sizetype quantity.
    
            * tree-ssa-loop-ivopts.cc (add_iv_candidate_for_use): Use
            split_constant_offset for the POINTER_PLUS_EXPR case.

Diff:
---
 gcc/tree-ssa-loop-ivopts.cc | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-ssa-loop-ivopts.cc b/gcc/tree-ssa-loop-ivopts.cc
index 957a3001e16..6671ff6db5a 100644
--- a/gcc/tree-ssa-loop-ivopts.cc
+++ b/gcc/tree-ssa-loop-ivopts.cc
@@ -3585,9 +3585,10 @@ 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.  */
-      base = strip_offset (base, &offset);
-      if (maybe_ne (offset, 0U))
-	record_common_cand (data, base, step, use);
+      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);
     }
 
   /* At last, add auto-incremental candidates.  Make such variables


More information about the Gcc-cvs mailing list