http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51988
Bug #: 51988 Summary: value_replacement in PHIOPT should handle even the cases where there are other PHIs even with non equal value Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: pins...@gcc.gnu.org Take: int g(int,int); int f(int t, int c) { int d = 0; int e = 0; if (t) { d = t; if (c) e = 1; } else d = 0, e = 0; return g(d,e); } --- CUT --- Currently we get: <bb 2>: if (t_5(D) != 0) goto <bb 3>; else goto <bb 5>; <bb 3>: if (c_7(D) != 0) goto <bb 4>; else goto <bb 5>; <bb 4>: <bb 5>: # d_1 = PHI <t_5(D)(4), 0(2), t_5(D)(3)> # e_2 = PHI <3(4), 0(2), 0(3)> But we could reduce it down to: <bb 2>: if (t_5(D) != 0) goto <bb 3>; else goto <bb 5>; <bb 3>: if (c_7(D) != 0) goto <bb 4>; else goto <bb 5>; <bb 4>: <bb 5>: # d_1 = PHI <t_5(D)(4), t_5(D)(2), t_5(D)(3)> # e_2 = PHI <3(4), 0(2), 0(3)> As t_5 on the edge from bb 2 to bb 5, t_5 is 0.