On 06/23/2016 12:56 PM, Martin Liška wrote:
Following patch changes minimum of ira-max-loops-num to 1.
Having the minimum equal to zero does not make much sense.

Ready after it finishes reg&bootstrap on x86_64-linux?

Hmm, why wouldn't a number of zero make sense if you want try to have all loops removed?

The problem seems to be here:

  for (i = 0; n - i + 1 > IRA_MAX_LOOPS_NUM; i++)
    {
      sorted_loops[i]->to_remove_p = true;

and this looks like an off-by-one error. n is the number of elements in the array, so if IRA_MAX_LOOPS_NUM is 1, it'll iterate i from 0 up to n-1, where
  n - i + 1 == 2 > 1
So it'll clear everything, where it seems like it should leave one loop around.

So maybe write this with a standard form of for loop so it's actually comprehensible:

  int maxidx = MIN (IRA_MAX_LOOPS_NUM, n);
  for (i = 0; i < maxidx; i++)
    {
       ....


Bernd

Reply via email to