------- Additional Comments From kazu at cs dot umass dot edu 2004-12-12 17:42 ------- Another (possibly expensive) approach would be to "ignore" statements whose results are used only in the basic block we are threading through.
Consider: # iftmp.0_1 = PHI <1(2), 0(3), 0(1)>; <L4>:; D.1171_13 = (unsigned char) iftmp.0_1; D.1160_14 = (int) D.1171_13; D.1145_16 = (unsigned char) D.1160_14; if (D.1145_16 != 0) goto <L8>; else goto <L14>; Note that the LHS of all MODIFY_EXPRs are used only in this basic block. So if we get to COND_EXPR and find out that COND_EXPR_COND is a constant (due to temporary propagation), then we can safely duplicate this basic block and thread an incoming edge (without causing code bloat). All the duplicate copies of MODIFY_EXPRs will be removed as dead code. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18576