It seems that neither FRE nor PRE can determine that stride.115 - 1 is the same as stride.115 + -1 in the example below (taken from the comm3 function in mgrid from SPEC2000). (Or am I missing something?)
<bb 2>: stride.115 = *n; stride.117 = stride.115 * stride.115; offset.118 = ~stride.115 - stride.117; D.1969 = stride.115 - 1; if (D.1969 > 1) goto <L68>; else goto <L24>; <L68>:; pretmp.221 = stride.115 + -1; pretmp.228 = offset.118 + pretmp.221; pretmp.236 = offset.118 + stride.115; i3 = 2; -- Summary: VAR - 1 not identified as the same as VAR + -1 Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dann at godzilla dot ics dot uci dot edu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27441