[PATCH] D46505: [DAGcombine] Teach the combiner about -a = ~a + 1

Amaury SECHET via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 26 04:57:58 PDT 2018


deadalnix added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2057-2059
+  if (N0.getOpcode() == ISD::XOR &&
+      isOneConstantOrOneSplatConstant(N1) &&
+      isAllOnesConstantOrAllOnesSplatConstant(N0.getOperand(1)))
----------------
spatel wrote:
> Use llvm::isBitwiseNot()? I don't think we care about vectors in the motivating cases, but you could extend that to handle a vector constant if it matters.
> 
> On 2nd thought, do we need this? It's not necessary for the test shown here, and instcombine already does that transform. If the pattern is created here in the DAG, it should have its own test (ie, this could be an independent patch).
You are correct that my motivation example doesn't require this. However, it seemed weird tome to to it for uaddo and addcarry, but not plain old add.


Repository:
  rL LLVM

https://reviews.llvm.org/D46505





More information about the llvm-commits mailing list