On 09/08/2015 09:17 AM, Jiong Wang wrote:

Jeff Law writes:

On 09/08/2015 06:17 AM, Jiong Wang wrote:

All other cost helper functions are using signed int to hold cost
while seq_cost is using unsigned int.

This fix this. bootstrap OK on x86.

OK for trunk?

2015-09-08  Jiong Wang  <jiong.w...@arm.com>

gcc/
    * rtl.h (seq_cost): Change return type from "unsigned" to "int".
    * rtlanal.c (seq_cost): Likewise.
Why not go the other way and start making things unsigned -- for a cost
function like this, unsigned seems more natural to me.

I was using "(unsigned) -1" to represent maximum cost, then later known
there is MAX_COST macro and found it's actually signed type, and quick
search shows most of the code in gcc/rtlanal.c, are using "int", so I am
changing seq_cost which seems to be the only cost helper using unsigned.
Understood. But the natural type should be unsigned as far as I can tell. The fact that we're using signed types all over the place is probably a historical wart.

So I'd start by changing the MAX_COST macro to an unsigned type, then fix any fallout from that. That should be a patch unto itself. Then we can have additional follow-up patches to fix the types of costing related variables, parameters & return values.

Jeff

Reply via email to