[PATCH] D62257: [DAGCombiner][X86][AArch64] (x - C) + y -> (x + y) - C fold

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 26 06:19:10 PDT 2019


RKSimon accepted this revision.
RKSimon added a comment.
This revision is now accepted and ready to land.

LGTM with one minor



================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2457
+  // Hoist one-use subtraction by constant:  (x - C) + y  ->  (x + y) - C
+  if (N0.hasOneUse() && N0.getOpcode() == ISD::SUB &&
+      isConstantOrConstantVector(N0.getOperand(1))) {
----------------
Add a comment explaining that this is necessary because SUB(X,C) -> ADD(X,-C) doesn't work for vectors.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62257





More information about the llvm-commits mailing list