[PATCH] D46494: [DAGCombiner] Masked merge: enhance handling of 'andn' with immediates

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 6 09:53:35 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5439
+    SDValue NewA = DAG.getNode(ISD::AND, DL, VT, D, NotM);
+    return DAG.getNode(ISD::OR, DL, VT, NewA, X);
+  }
----------------
spatel wrote:
> How did this become an 'or'?
> https://rise4fun.com/Alive/UMY
> 
> We should have a comment/formula to describe the overall transform and why it makes sense:
>   // If we can't form an 'andn' with Y (because it's a constant), 
>   // swap the final xor operand, so we can still use 'andn' to invert the mask:
>   // ((X ^ C) & M) ^ C -->  ((X ^ C) & NotM') ^ X
o_O
Great catch!

I was initially experimenting with still proceeding to unfold the pattern here, not just de-canonicalize it,
and clearly i did not fully undo all the changes..

That means i need to re-do mca analysis for this.


Repository:
  rL LLVM

https://reviews.llvm.org/D46494





More information about the llvm-commits mailing list