[PATCH] D60460: [SelectionDAG] Let computeKnownBits handle OR-like ADDs better

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 9 07:23:51 PDT 2019


lebedev.ri added a comment.

This looks ok, but should have more tests.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2971-2974
+    KnownBits Known3;
+    Known3 = computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
+    KnownZeroHigh = std::min(KnownZeroHigh, Known3.countMinLeadingZeros());
+    KnownZeroLow = std::min(KnownZeroLow, Known3.countMinTrailingZeros());
----------------
When committing, this should/could be a separate change.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2986
 
+    if (Opcode == ISD::ADD && (Known2.Zero | Known3.Zero).isAllOnesValue()) {
+      // This ADD can be treated just like an OR (no common bits set in the
----------------
This **is** correct, what `llvm::haveNoCommonBitsSet()` does.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60460





More information about the llvm-commits mailing list