On 6/1/23 11:54 PM, Ajit Agarwal via Gcc-patches wrote:
> 
> 
> On 01/06/23 2:06 pm, Bernhard Reutner-Fischer wrote:
>> On 1 June 2023 09:20:08 CEST, Ajit Agarwal <aagar...@linux.ibm.com> wrote:
>>> Hello All:
>>>
>>> This patch improves code sinking pass to sink statements before call to 
>>> reduce
>>> register pressure.
>>> Review comments are incorporated.
>>
>> Hi Ajit!
>>
>> I had two comments for v4 that you did not address in v5 or followed up.
>> thanks,
> 
> Which comments I didn't address. Please let me know.

I believe he's referring to these two comments:

  > +     && dominated_by_p (CDI_DOMINATORS, new_best_bb, early_bb))
  > +   {
  > +     if (def_use_same_block (use))
  > +       return best_bb;
  > +
  > +     return new_best_bb;
  > +   }
  > +   return best_bb;
  > +    }
  >  

  Many returns.
  I'd have said
          && !def_use_same_block (use)
        return new_best_bb;
      else
        return best_bb;

  and rephrase the comment above list of Things to consider accordingly.


I agree with Bernhard's comment that it could be rewritten to be clearer.
Although, the "else" isn't really required.  So Bernhard's version would
look like:

  if (new_best_bb
      && use
      && new_best_bb != best_bb
      && new_best_bb != early_bb
      && !is_gimple_call (stmt)
      && gsi_end_p (gsi_start_phis (new_best_bb))
      && gimple_bb (use) != early_bb
      && !is_gimple_call (use)
      && dominated_by_p (CDI_POST_DOMINATORS, new_best_bb, gimple_bb (use))
      && dominated_by_p (CDI_DOMINATORS, new_best_bb, early_bb)
      && !def_use_same_block (use))
    return new_best_bb;
  else
    return best_bb;

...or just:

  if (new_best_bb
      && use
      && new_best_bb != best_bb
      && new_best_bb != early_bb
      && !is_gimple_call (stmt)
      && gsi_end_p (gsi_start_phis (new_best_bb))
      && gimple_bb (use) != early_bb
      && !is_gimple_call (use)
      && dominated_by_p (CDI_POST_DOMINATORS, new_best_bb, gimple_bb (use))
      && dominated_by_p (CDI_DOMINATORS, new_best_bb, early_bb)
      && !def_use_same_block (use))
    return new_best_bb;

  return best_bb;


Either works.


Peter

Reply via email to