[4.1 PATCH] Fix tree-ssa/loop-14.c test case failure, take 3
Ulrich Weigand
uweigand@de.ibm.com
Thu Jan 19 20:52:00 GMT 2006
I wrote:
> Do you think it would be less risk for 4.1 to backport this part of
> your recent patch only, instead of changing the cost computation?
This would be something like the following patch, which also fixes
the loop-14.c regression on s390(x).
Bootstrapped/regtested on s390-ibm-linux/s390x-ibm-linux.
OK for 4.1 branch?
Bye,
Ulrich
ChangeLog:
Backport from mainline:
2006-01-06 Zdenek Dvorak <dvorakz@suse.cz>
* tree-scalar-evolution.c (scev_const_prop): Evaluate expensiveness
of computing # of iterations instead of the final expression.
Index: gcc/tree-scalar-evolution.c
===================================================================
*** gcc/tree-scalar-evolution.c (revision 109753)
--- gcc/tree-scalar-evolution.c (working copy)
*************** scev_const_prop (void)
*** 2723,2729 ****
for (i = current_loops->num - 1; i > 0; i--)
{
edge exit;
! tree def, rslt, ass;
block_stmt_iterator bsi;
loop = current_loops->parray[i];
--- 2723,2729 ----
for (i = current_loops->num - 1; i > 0; i--)
{
edge exit;
! tree def, rslt, ass, niter;
block_stmt_iterator bsi;
loop = current_loops->parray[i];
*************** scev_const_prop (void)
*** 2733,2740 ****
/* If we do not know exact number of iterations of the loop, we cannot
replace the final value. */
exit = loop->single_exit;
! if (!exit
! || number_of_iterations_in_loop (loop) == chrec_dont_know)
continue;
/* Ensure that it is possible to insert new statements somewhere. */
--- 2733,2746 ----
/* If we do not know exact number of iterations of the loop, we cannot
replace the final value. */
exit = loop->single_exit;
! if (!exit)
! continue;
!
! niter = number_of_iterations_in_loop (loop);
! if (niter == chrec_dont_know
! /* If computing the number of iterations is expensive, it may be
! better not to introduce computations involving it. */
! || expression_expensive_p (niter))
continue;
/* Ensure that it is possible to insert new statements somewhere. */
*************** scev_const_prop (void)
*** 2763,2773 ****
|| chrec_contains_symbols_defined_in_loop (def, ex_loop->num))
continue;
- /* If computing the expression is expensive, let it remain in the
- loop. */
- if (expression_expensive_p (def))
- continue;
-
/* Eliminate the phi node and replace it by a computation outside
the loop. */
def = unshare_expr (def);
--- 2769,2774 ----
--
Dr. Ulrich Weigand
Linux on zSeries Development
Ulrich.Weigand@de.ibm.com
More information about the Gcc-patches
mailing list