[PATCH] [x86] add a reassociation optimization to increase ILP via the MachineCombiner pass

Sanjay Patel spatel at rotateright.com
Tue Jun 9 16:31:05 PDT 2015


In http://reviews.llvm.org/D10321#185889, @Gerolf wrote:

> Hi Sanjay,
>
> is this on phabricator?


Yes - although there may be something odd going on here because I got a duplicate email for each of your comments. Let me know if I need to send directly to the mailing list.

> My understanding of the code is that you reassociate patterns like A = ?? op ??; B = A op X; C = B op Y, but your comments suggest A’s statement can use any operand. Please check in isReassocCandidate():

> 

> +  // We must match a simple chain of dependent ops.

>  +  if (checkPrevOpcode && MI1->getOpcode() != AssocOpcode)

>  +    return nullptr;

> 

> and note that for all incarnations checkPrevOpcode is ‘true’. Or do I miss something?


Sorry - my comment here and in the code is not clear enough. I would like to set checkPrevOpcode to 'false' in a follow-on patch. This would allow, for example, this sequence to be optimized:

  A = ? mul ?   <--- 'mul' could actually be anything here
  B = A add X
  C = B add Y

For now, I limited the pattern to only match when there are 3 consecutive 'add' ops:

  A = ? add ?
  B = A add X
  C = B add Y

I did this because if we allow the more liberal matching of the first sequence, I'm seeing that the transform will trigger more often, but not necessarily for any benefit because of the logic in the machine combiner that replaces instructions as long as they are no worse than the original sequence. Please let me know if that makes things clearer.


http://reviews.llvm.org/D10321

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list