This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA:] cse.c (fold_rtx): Find cheaper comparison equivalent (was: Patches ping...)
- From: Roger Sayle <roger at eyesopen dot com>
- To: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 31 Jan 2006 15:40:00 -0700 (MST)
- Subject: Re: [RFA:] cse.c (fold_rtx): Find cheaper comparison equivalent (was: Patches ping...)
On Tue, 31 Jan 2006, Hans-Peter Nilsson wrote:
> * cse.c (fold_rtx) <case RTX_COMM_COMPARE, RTX_COMPARE>: When arg1
> has a constant equivalent, iterate over equivalents for arg0,
> calling simplify_relational_operation and if there's a result
> cheaper than X, apply fold_rtx and return the result.
Ok for mainline with one very minor improvement:
> + cost = COST (simp_result);
> + if (cost < cheapest_cost)
> + {
> + cheapest_cost = COST (simp_result);
You can use "cost" in the assignment to cheapest_cost above and
save yourself a duplicate call to rtx_costs via COST.
Thanks for taking the time to implement this suggestion.
Now to investigate (or file enhancement PRs) for the RTL optimizations
suggested above that aren't yet implemented in simplify-rtx.c :)
Roger
--