The attached test case contains two equivalent functions. The second one produces better code, because it has been manually CSE'd. The problem is that fold-const is doing the conversion of 'a ==V1 || a == V2' (V2 == V1 + 1) into '(a - V1) <= (V2 - V1)', but that can't be done until we spot that both RHS of the && are identical.
Death to fold-const! -- Summary: in range test not noticed Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nathan at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19104