[PATCH] D59174: [DAGCombine] Fold (x & ~y) | y patterns

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 17 08:54:19 PDT 2019


nikic marked an inline comment as done.
nikic added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5418-5419
 
   if (SDValue Combined = visitORLike(N0, N1, N))
     return Combined;
 
----------------
lebedev.ri wrote:
> Actually, there already is this function, but it is only called in one order.
> I suppose a follow-up to move contents of `visitORCommutative()` into `visitORLike()`,
> and calling `visitORLike()` second time may be a good idea.
The existing transforms inside visitORLike wouldn't benefit from being called with commuted arguments (apart from the very first one maybe), as they check for symmetric patterns. Looking at other folds in visitOR most everything either has one constant operand (which is always on the RHS) or deals with symmetric patterns, or is a very simple fold that probably should stay at the start. I think that MatchRotate could in principle be refactored to be called twice with commuted arguments, but it would be larger change to the logic.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D59174





More information about the llvm-commits mailing list