This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix tree-ssa/loop-14.c test case failure, take 2
- From: Ulrich Weigand <uweigand at de dot ibm dot com>
- To: rakdver at atrey dot karlin dot mff dot cuni dot cz (Zdenek Dvorak)
- Cc: uweigand at de dot ibm dot com (Ulrich Weigand), gcc-patches at gcc dot gnu dot org
- Date: Wed, 18 Jan 2006 21:12:53 +0100 (CET)
- Subject: [PATCH] Fix tree-ssa/loop-14.c test case failure, take 2
Zdenek Dvorak wrote:
> the replacement in loop-14.c should not happen in ivopts, but
> in tree-scalar-evolution.c:scev_const_prop.
Thanks for the hint!
The reason why it didn't happen there is that the replacement was rejected
as 'too expensive' due to an incorrect cost computation.
The function seq_cost in tree-ssa-loop-ivopts.c passes the full pattern
of a SET insn to the rtx_cost function. However, that function is intended
to receive just an RTX erepresenting an expression to be computed, i.e.
in this case seq_cost should be passing the SET_SRC of set SET to rtx_cost.
Compare how this is handled in insn_rtx_costs.
The following patch fixes this, and thus fixes the loop-14 testcase on s390(x).
Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux.
OK for mainline and 4.1?
Bye,
Ulrich
ChangeLog:
* tree-ssa-loop-ivopts.c (seq_cost): Pass source of SET to rtx_cost,
not the full SET pattern.
Index: gcc/tree-ssa-loop-ivopts.c
===================================================================
*** gcc/tree-ssa-loop-ivopts.c (revision 109753)
--- gcc/tree-ssa-loop-ivopts.c (working copy)
*************** seq_cost (rtx seq)
*** 2447,2453 ****
{
set = single_set (seq);
if (set)
! cost += rtx_cost (set, SET);
else
cost++;
}
--- 2447,2453 ----
{
set = single_set (seq);
if (set)
! cost += rtx_cost (SET_SRC (set), SET);
else
cost++;
}
--
Dr. Ulrich Weigand
Linux on zSeries Development
Ulrich.Weigand@de.ibm.com