http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55936
Bug #: 55936 Summary: Missed VRP optimization Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: l...@redhat.com gcc.dg/tree-ssa/vrp06.c looks like: foo (int i, int j, int a) { if (i >= 10) if (i <= 30) if (i == j) { a--; /* This should fold to 'if (0)'. */ if (i < 0) i = baz (); /* This should fold to 'if (1)'. */ if (j > 0) a--; /* This should fold to 'if (0)'. */ if (i != j) return 0; } return i + a + j; } VRP is supposed to optimize away the 3 innermost conditions in a single pass; the key being to realize that the test i < 0 is always false and thus i does not vary (nor does j vary). Once i & j are determined to have non-varying values, we should be able to optimize away the i != j test because we're in the true clause if the i == j test. Unfortunately, VRP drops i to varying and it's unable to optimize away the last test during the first VRP pass. It does get optimized later.