[PATCH] D156778: [SelectionDAG] Improve `isKnownToBeAPowerOfTwo`

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 03:34:21 PDT 2023


RKSimon added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4139
+
+  if (Val.getOpcode() == ISD::AND) {
+    for (unsigned OpIdx = 0; OpIdx < 2; ++OpIdx) {
----------------
Add comments describing the and(x,neg(x)) pattern


================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:4145
+          ISD::matchUnaryPredicate(NegOp.getOperand(0), [](ConstantSDNode *C) {
+            return C->isZero();
+          }))
----------------
Do you need to use matchUnaryPredicate or could you just call isNullOrNullSplat ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156778



More information about the llvm-commits mailing list