[PATCH] D32458: [InstSimplify] Handle (~A & ~B) | (~A ^ B) -> ~A ^ B

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 06:25:47 PDT 2017


spatel added a comment.

Nice catch. Just curious - did you find that by inspection or did it show up as a regression somewhere? I wonder if we should ease the one-use restrictions in the DeMorgan code in instcombine.



================
Comment at: lib/Analysis/InstructionSimplify.cpp:1887-1888
 
   // (A & ~B) | (A ^ B) -> (A ^ B)
   // (~B & A) | (A ^ B) -> (A ^ B)
+  if (match(Op1, m_Xor(m_Value(A), m_Value(B))) &&
----------------
Can you add the other 2 patterns to the comment here? I get nervous when the listed formulas don't match the code...because usually we're missing some commuted possibility.


https://reviews.llvm.org/D32458





More information about the llvm-commits mailing list