[PATCH] D144606: [InstCombine] Add transforms for `(max/min (xor X, Pow2), X)` -> `(and/or X, Pow2/~Pow2)`

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 08:45:37 PST 2023


spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:1498-1500
+          // Negative power of 2 must be IntMin. Its possible to be able to
+          // prove negative / power of 2 without actually having known bits, so
+          // just get the value by hand.
----------------
If we can prove that some value is a constant, then shouldn't we have zapped it already?
The test example shows that we are missing a fold like this:
https://alive2.llvm.org/ce/z/z5xok2


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144606



More information about the llvm-commits mailing list