tree-ssa-loop-ivopts.c (get_computation_cost_at): Check depends_on before using it.
authorBin Cheng <bin.cheng@arm.com>
Tue, 3 May 2016 08:54:49 +0000 (08:54 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Tue, 3 May 2016 08:54:49 +0000 (08:54 +0000)
* tree-ssa-loop-ivopts.c (get_computation_cost_at): Check depends_on
before using it.

From-SVN: r235807

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

index d5895cacf5470a0633a35df6be62e661743e90ed..45670bc2000a4f4aca0182af056b20471dd645e3 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-03  Bin Cheng  <bin.cheng@arm.com>
+
+       * tree-ssa-loop-ivopts.c (get_computation_cost_at): Check depends_on
+       before using it.
+
 2016-05-03  Bin Cheng  <bin.cheng@arm.com>
 
        * tree-ssa-loop-ivopts.c (get_computation_cost_at): Don't clobber
index e6d35a4af7a56157be0247362f76051a334ae812..b24cac4e0cd5b247cd7033c3025d1f68df384430 100644 (file)
@@ -4846,12 +4846,12 @@ get_computation_cost_at (struct ivopts_data *data,
   /* Record setup cost in scrach field.  */
   cost.scratch = cost.cost;
 
-  if (inv_expr_id)
+  if (inv_expr_id && depends_on && *depends_on)
     {
       *inv_expr_id =
           get_loop_invariant_expr_id (data, ubase, cbase, ratio, address_p);
       /* Clear depends on.  */
-      if (*inv_expr_id != -1 && depends_on && *depends_on)
+      if (*inv_expr_id != -1)
         bitmap_clear (*depends_on);
     }