[PATCH] D157289: [InstCombine] Fold (-a >> b) and/or/xor (~a >> b) into (-a and/or/xor ~a) >> b tests

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 03:13:25 PDT 2023


nikic added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/binop-and-shifts.ll:568
+  ret i8 %and
+}
+
----------------
All of these tests have `ashr(xor)` rather than `xor(ashr)` as the input. However, the latter is what it gets canonicalized to. It would be better to directly use the latter form, so it's clearer what the transform operates on.

We should also adjust the proofs accordingly, e.g. https://alive2.llvm.org/ce/z/Dds-Nw has the xor in the position the transform looks for it.


================
Comment at: llvm/test/Transforms/InstCombine/binop-and-shifts.ll:902
+  ret <4 x i8> %xor
+}
----------------
I think this could use two more negative tests:
* Something other than -1 as the xor constant.
* A binop for which this is not valid, e.g. add instead of and/or/xor.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157289



More information about the llvm-commits mailing list