[PATCH] D145143: [DAGCombiner] Add fold for `~x & x` -> `0`

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 14:11:28 PST 2023


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

LGTM with a couple of minors



================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:6634
 
+  if (areBitwiseNotOfEachother(N0, N1))
+    return DAG.getConstant(APInt::getZero(N1.getScalarValueSizeInBits()),
----------------
Don't bother with the helper - just inline the check.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:6636
+    return DAG.getConstant(APInt::getZero(N1.getScalarValueSizeInBits()),
+                           SDLoc(N), N1.getValueType());
+
----------------
Use VT instead of getScalarValueSizeInBits/getValueType


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145143



More information about the llvm-commits mailing list