[PATCH] D16978: [InstCombine] Try harder to simplify ~(X & Y) -> ~X | ~Y and ~(X | Y) -> ~X & ~Y when X and Y have more than one uses.

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 06:22:04 PDT 2016

mcrosier added inline comments.

Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1350
@@ +1349,3 @@
+  // - Constant) - A` if we are willing to invert some of the uses.
+  if (BinaryOperator *BO = dyn_cast<BinaryOperator>(V)) {
+    // Must be an 'add' or a 'sub'.
bmakam wrote:
> IIRC, instcombine is still early to assume that that constants are always canonicalized to the RHS.
Okay, I just wanted to check.  FWIW, the reassocation pass is responsible for the canonicalization.


More information about the llvm-commits mailing list