http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52409
Bug #: 52409 Summary: ((~a)|(~b)) is not simplified at the tree level Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: pins...@gcc.gnu.org Take: int f(int a, int b) { a = ~a; b = ~b; return a|b; } int g(int a, int b) { return ~(a&b); } --- CUT --- Currently the tree level does not try to combine them, fold does it though. I saw this with bools in GCC itself. In the bool case, we can fold it further to just (a&b) == 0. Likewise for (~a)&(~b) into ~(a|b).