This is the mail archive of the
mailing list for the GCC project.
Best way to compute cost of a sequence of gimple stmt
- From: "Thomas Preud'homme" <thomas dot preudhomme at arm dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Tue, 10 Jun 2014 16:32:44 +0800
- Subject: Best way to compute cost of a sequence of gimple stmt
- Authentication-results: sourceware.org; auth=none
With recent changes to it, the bswap pass can now replace a series of
(probably aligned) load + bitwise operation (AND, OR and shifts) + casts
by a (potentially unaligned) load and a bswap. I was rightfully pointed
out that this might be more expensive than the original sequence of
gimple statements. Therefore I am trying to compute the cost of the
sequence with and without the transformation to make an informed
So far I proceeded by reusing the computation_cost function from
ivopts and various functions from expmed (shift_cost, convert_cost
and some new ones: rot_cost for instance). However, this doesn't
allow me to compute the cost of a function call (the call to the bswap
builtin) and I am lurking towards exposing expand_gimple_stmt () in
a new function gimple_stmt_cost (). I am wondering though if it is a
correct thing to do as I am not familiar with how expansion operates.
I am also wondering if I should use gimple_stmt_cost as seldomly as
possible or on the contrary make use of it for all statements so as to
get rid of the modifications in ivopts and expmed.
I'd appreciate any advices on how to compute the cost of a sequence
of gimple statements.