[PATCH] D116270: [AMDGPU] Enable divergence-driven XNOR selection

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 11 09:37:50 PST 2022


foad added a comment.

In D116270#3234484 <https://reviews.llvm.org/D116270#3234484>, @alex-t wrote:

> Removing this guard leads to the infinite transforming the pattern back and forth in SITargetLowering::reassociateScalarOps and DAGCombiner::ReassociateOps().
> The former transform (xor (xor uniform, divergent), -1) to (xor (xor uniform, -1), divergent) but the latter one transform it back by applying this rule:
>
>   if (N0.hasOneUse()) {
>    ** // Reassociate: (op (op x, c1), y) -> (op (op x, y), c1)
>     //              iff (op x, c1) has one use**
>     if (SDValue OpNode = DAG.getNode(Opc, SDLoc(N0), VT, N00, N1))
>       return DAG.getNode(Opc, DL, VT, OpNode, N01);
>     return SDValue();
>   }

Oh dear. I don't really understand why the common code is doing this. The idea seems to come from a FIXME added in e260ed8628bbe245ffc39b130d121f2f50dc0bce

I think it is worth trying to change this generic combine to give up if x is uniform and y is divergent.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116270/new/

https://reviews.llvm.org/D116270



More information about the llvm-commits mailing list