This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][IRA] Analysis of register usage of functions for usage by IRA.
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: Tom_deVries at mentor dot com (Tom de Vries)
- Cc: vmakarov at redhat dot com (Vladimir Makarov), stevenb dot gcc at gmail dot com (Steven Bosscher), gcc-patches at gcc dot gnu dot org (gcc-patches at gcc dot gnu dot org), robradovic at mips dot com (Radovan Obradovic)
- Date: Mon, 1 Sep 2014 18:41:28 +0200 (CEST)
- Subject: Re: [PATCH][IRA] Analysis of register usage of functions for usage by IRA.
- Authentication-results: sourceware.org; auth=none
Tom de Vries wrote:
> * ira-costs.c (ira_tune_allocno_costs): Use
> ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS to adjust costs.
In debugging PR 53864 on s390x-linux, I ran into a weird change in behavior
that occurs when the following part of this patch was checked in:
> - if (ira_hard_reg_set_intersection_p (regno, mode, call_used_reg_set)
> - || HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
> - cost += (ALLOCNO_CALL_FREQ (a)
> - * (ira_memory_move_cost[mode][rclass][0]
> - + ira_memory_move_cost[mode][rclass][1]));
> + crossed_calls_clobber_regs
> + = &(ALLOCNO_CROSSED_CALLS_CLOBBERED_REGS (a));
> + if (ira_hard_reg_set_intersection_p (regno, mode,
> + *crossed_calls_clobber_regs))
> + {
> + if (ira_hard_reg_set_intersection_p (regno, mode,
> + call_used_reg_set)
> + || HARD_REGNO_CALL_PART_CLOBBERED (regno, mode))
> + cost += (ALLOCNO_CALL_FREQ (a)
> + * (ira_memory_move_cost[mode][rclass][0]
> + + ira_memory_move_cost[mode][rclass][1]));
> #ifdef IRA_HARD_REGNO_ADD_COST_MULTIPLIER
> - cost += ((ira_memory_move_cost[mode][rclass][0]
> - + ira_memory_move_cost[mode][rclass][1])
> - * ALLOCNO_FREQ (a)
> - * IRA_HARD_REGNO_ADD_COST_MULTIPLIER (regno) / 2);
> + cost += ((ira_memory_move_cost[mode][rclass][0]
> + + ira_memory_move_cost[mode][rclass][1])
> + * ALLOCNO_FREQ (a)
> + * IRA_HARD_REGNO_ADD_COST_MULTIPLIER (regno) / 2);
> #endif
> + }
Before that patch, this code would penalize all call-clobbered registers
(if the alloca is used across a call), and it would penalize *all* registers
in a target-dependent way if IRA_HARD_REGNO_ADD_COST_MULTIPLIER is defined;
the latter is completely independent of the presence of any calls.
However, after that patch, the IRA_HARD_REGNO_ADD_COST_MULTIPLIER penalty
is only applied for registers clobbered by calls in this function. This
seems a completely unrelated change, and looks just wrong to me ...
Was this done intentionally or is this just an oversight?
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com