[PATCH] D57754: [DAGCombiner] (add (umax X, C), -C) --> (usubsat X, C) (PR40111)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 5 11:41:39 PST 2019


nikic added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2164
+  if (N0.getOpcode() == ISD::UMAX &&
+      (!LegalOperations || TLI.isOperationLegal(ISD::USUBSAT, VT))) {
+    auto MatchUSUBSAT = [](ConstantSDNode *Max, ConstantSDNode *Op) {
----------------
I'm not familiar with the nuances of the legality checking here, but wondering if using the `hasOperation(ISD::USUBSAT, VT)` helper would make more sense? If usubsat is not legal or custom, then the created usubsat is going to be expanded back into umax+add during legalization again anyway.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D57754





More information about the llvm-commits mailing list