Consider: int foo (int a, int b) { if (a > 50) return 19; if (a > 63 && b < 50) return 17; return 31; }
VRP does not optimize away the second "if" statement. Here is the output from VRP. foo (a, b) { _Bool D.1662; _Bool D.1661; _Bool D.1660; int D.1659; <bb 2>: if (a_2 > 50) goto <L4>; else goto <L1>; <L1>:; D.1660_4 = 0; D.1661_6 = b_5 <= 49; D.1662_7 = 0; if (D.1662_7) goto <L2>; else goto <L4>; <L2>:; # D.1659_1 = PHI <19(2), 17(4), 31(3)>; <L4>:; return D.1659_1; } -- Summary: VRP misses an "if" statement that could be optimized away Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kazu at gcc dot gnu dot org GCC target triplet: x86_64-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25485