re PR tree-optimization/69042 (Missed optimization in ivopts)
authorBin Cheng <bin.cheng@arm.com>
Wed, 23 Mar 2016 15:24:20 +0000 (15:24 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Wed, 23 Mar 2016 15:24:20 +0000 (15:24 +0000)
PR tree-optimization/69042
* tree-ssa-loop-ivopts.c (add_iv_candidate_for_use): Add IV cand
for use with constant offset stripped in base.

From-SVN: r234429

gcc/ChangeLog
gcc/tree-ssa-loop-ivopts.c

index 6538ff096f8cac16870b2e423e63968cfd3b36bd..e035f1b678af0315e30733a18d1f10cb1fd984d0 100644 (file)
@@ -1,3 +1,9 @@
+2016-03-23  Bin Cheng  <bin.cheng@arm.com>
+
+       PR tree-optimization/69042
+       * tree-ssa-loop-ivopts.c (add_iv_candidate_for_use): Add IV cand
+       for use with constant offset stripped in base.
+
 2016-03-23  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/70251
index 5302edf928427e6f07392c6424254c22de7b7c36..99dd4d0b7ec25220dc545137dfaf9cf547454f5b 100644 (file)
@@ -3232,11 +3232,13 @@ add_iv_candidate_for_use (struct ivopts_data *data, struct iv_use *use)
     basetype = sizetype;
   record_common_cand (data, build_int_cst (basetype, 0), iv->step, use);
 
-  /* Record common candidate with constant offset stripped in base.  */
+  /* Record common candidate with constant offset stripped in base.
+     Like the use itself, we also add candidate directly for it.  */
+  base = strip_offset (iv->base, &offset);
+  if (offset || base != iv->base)
     {
-      base = strip_offset (iv->base, &offset);
-      if (offset || base != iv->base)
-       record_common_cand (data, base, iv->step, use);
+      record_common_cand (data, base, iv->step, use);
+      add_candidate (data, base, iv->step, false, use);
     }
 
   /* Record common candidate with base_object removed in base.  */