This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] sub(xor(x, y), or(x, y)) -> neg(and(x, y))
ClosedPublic

Authored by xbolva00 on Sep 4 2019, 10:36 AM.

Details

Summary
Name: sub(xor(x, y), or(x, y)) -> neg(and(x, y))
%or = or i32 %y, %x
%xor = xor i32 %x, %y
%sub = sub i32 %xor, %or
  =>
%sub1 = and i32 %x, %y
%sub = sub i32 0, %sub1

Optimization: sub(xor(x, y), or(x, y)) -> neg(and(x, y))
Done: 1
Optimization is correct!

https://rise4fun.com/Alive/8OI

Diff Detail

Repository
rL LLVM

Event Timeline

xbolva00 created this revision.Sep 4 2019, 10:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2019, 10:36 AM
lebedev.ri accepted this revision.Sep 4 2019, 10:57 AM

LG, thanks.

I wonder what other similar 3-instruction folds are missing.

This revision is now accepted and ready to land.Sep 4 2019, 10:57 AM
This revision was automatically updated to reflect the committed changes.

Thank you.

Next one which we miss: (~a & b) ^ a -> (a | b)