diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index d346e00..7e53b30 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -4113,6 +4113,7 @@ get_computation_cost_at (struct ivopts_data *data,
   else if (ratio == 1)
     {
       tree real_cbase = cbase;
+      int diff_cost, add_cost_val;
 
       /* Check to see if any adjustment is needed.  */
       if (cstepi == 0 && stmt_is_after_inc)
@@ -4132,7 +4133,20 @@ get_computation_cost_at (struct ivopts_data *data,
 			      ubase, real_cbase,
 			      &symbol_present, &var_present, &offset,
 			      depends_on);
+      diff_cost = cost.cost;
       cost.cost /= avg_loop_niter (data->current_loop);
+      add_cost_val = add_cost (TYPE_MODE (ctype), data->speed);
+      /* Do cost correction when address difference produces
+         additional non-invariant add operation which is less
+         profitable if address cost is cheaper than cost of add.  */
+      if (address_p && diff_cost > add_cost_val
+          && get_address_cost (symbol_present, var_present,
+                               offset, ratio, cstepi,
+                               TYPE_MODE (TREE_TYPE (utype)),
+                               TYPE_ADDR_SPACE (TREE_TYPE (utype)),
+                               speed, stmt_is_after_inc,
+                               can_autoinc).cost <= add_cost_val)
+        cost.cost += add_cost_val;
     }
   else if (address_p
 	   && !POINTER_TYPE_P (ctype)
