------- Additional Comments From kazu at cs dot umass dot edu 2005-02-07 06:45 ------- Here is a test case where a jump threading opportunity would be missed if the change suggested in the original post were made:
void foo (int *p) { if (*p != 0) bar (); if (*p != 0) bar (); } Here is a tree dump right before the first DOM. foo (p) { int D.1120; <bb 0>: D.1120_2 = *p_1; if (D.1120_2 != 0) goto <L0>; else goto <L1>; <L0>:; bar (); <L1>:; D.1120_3 = *p_1; if (D.1120_3 != 0) goto <L2>; else goto <L3>; <L2>:; bar (); <L3>:; return; } The change I suggested would record "D.1120_2 == 2" while following edge from <L0> to <L2>. Then th jump threading selection code figures out that D.1120_3 = *p_1; is the same as D.1120_3 = 0; via equality "D.1120_3 == D.1120_2". For whatever reason, the jump threading selection code does not want to see anything but SSA_NAME on the rhs. At that point, DOM throws away this jump threading opportunity. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19804