Consider: int foo (int a) { int b = a != 0; unsigned char c = b; if (c) return 1; else return 0; }
We end up with code like this: b_3 = a_2 != 0; c_4 = (unsigned char) b_3; if (c_4 != 0) goto <L0>; else goto <L2>; We want to forward-propagate the preceding two statements into the COND_EXPR and get if (a_2 != 0) goto <L0>; else goto <L2>; Unlike forward propagation opportunities noted in PR 14754 or PR15558, this kind of opportunity occurs often in practice. -- Summary: Another missed forward propagation opportunity Product: gcc Version: unknown Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: tree-optimization AssignedTo: kazu at cs dot umass dot edu ReportedBy: kazu at cs dot umass dot edu CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21031