[PATCH] D142271: [ValueTracking] Add KnownBits patterns `xor(x, x - 1)` and `and(x, -x)` for knowing upper bits to be zero

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 20 21:21:15 PST 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1089
+    // above it.
+    // TODO: instcombine has a habit of commuting independent `and` which can
+    // hide this pattern. Try to match and(x, and(-x, y)) / and(and(x, y), -x).
----------------
that sounds more like reassociating than commuting.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142271



More information about the llvm-commits mailing list