Consider: int foo (int a, int b) { int c = a; int d; if (a == c) d = a; else d = b; return d; } Note that "a == c" always holds, so the whole function should collapse down to return a;. However, copy-prop on TCB outputs foo (a, b) { int d; int c; int D.1137; <bb 0>: c_3 = a_2; d_8 = a_2; # d_1 = PHI <a_2(0)>; <L2>:; d_4 = d_1; return d_1; } Note that we are still returning d_1. Not good. The problem is that we are not folding COND_EXPR_COND during propagation.
Confirmed.
PR20913 has a better testcase. *** This bug has been marked as a duplicate of 20913 ***