Hi there,

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
decision.

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.

Best regards,

Thomas Preud'homme


Reply via email to