------- Additional Comments From law at redhat dot com 2004-12-13 17:28 ------- Subject: Re: [3.4/4.0 Regression] missing jump threading because of type changes
On Mon, 2004-12-13 at 17:13 +0000, kazu at cs dot umass dot edu wrote: > Sorry, the example was a little bad. I had something like this in my > mind. > > # iftmp.0_1 = PHI <a_1(2), 0(3)>; > <L4>:; > D.1171_13 = iftmp.0_1 + 1; > if (D.1171_13 != 0) goto <L8>; else goto <L14>; > > Note that D.1171_13 is partially constant. I guess we should really > transform this into > > <bb 2>: > a_2 = a_1 + 1; > > # D.1171_13 = PHI <a_2(2), 1(3)>; > <L4>:; > if (D.1171_13 != 0) goto <L8>; else goto <L14>; > > Of course, if there are a lot of incoming edges that do not have > constant PHI arguments, sending "+ 1" upstream would cause code bloat. > We could "fix" this by creating a helper block that does "+ 1" and > then jump to L4, but things get more and more complicated, and I don't > know if it's profitable. Not really. We should thread the edge coming from block 3. Again, this is precisely the kind of thing we can and should be doing in the selection code now that the SSA updating code can handle it. > > Another thing I've seen blocking a jump threading opportunity is: > > <L4>:; > D.1171_13 = global_variable; > if (D.1171_13 != 0) goto <L8>; else goto <L14>; > > Where the value of global_variable is known on one of the incoming > edges of L4. I guess we need to remove partially redundancy > associated with this load and shouldn't blame the jump threader. That > is, we should transform the code above to > > D.1171_13 = PHI <...(2), ...(3)> > <L4>:; > if (D.1171_13 != 0) goto <L8>; else goto <L14>; Again, this should be something we can handle in the threader. If we know the value of the global on one more more incoming edges, then we ought to be able to thread it. The only reason we do not in cases like this is because the old SSA updating code couldn't handle this kind of update because the assignment to D.1171_13 might need to be preserved on one or more paths. I don't see anything in these example that can not and should not be handled by fixing the jump thread selection code. In fact, they are all just instances of issues I have already seen and designed the SSA updating code to property handle. jeff -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18576