On 11/3/07, Richard Guenther <[EMAIL PROTECTED]> wrote: > On 11/3/07, Zdenek Dvorak <[EMAIL PROTECTED]> wrote: > > Hi, > > > > > >> I believe that this is something new and is most likely fallout from > > > >> diego's reworking of the tree to rtl converter. > > > >> > > > >> To fix this will require a round of copy propagation, most likely in > > > >> concert with some induction variable detection, since the most > > > >> profitable place for this will be in loops. > > > >> > > > >> I wonder if any of this effects the rtl level induction variable > > > >> discovery? > > > >> > > > > > > > > it should not (iv analysis is able to deal with this kind of ivs). > > > > > > > does the iv analysis canonize them in a way that we should perhaps > > > consider moving the auto-inc detection after the iv analysis? > > > > no, iv analysis does not change the program; also, since the code in > > this particular example is not in any loop, iv analysis is somewhat > > irrelevant for it. > > > > Btw. I would have actually expected this code to be folded to > > > > *a_3(D) = D.1543_2; > > a_4 = a_3(D) + 1; > > b_5 = b_1(D) + 1; > > D.1543_6 = *b_5; > > *a_4 = D.1543_6; > > a_7 = a_3 + 2; > > b_8 = b_1 + 2; > > D.1543_9 = *b_8; > > *a_7 = D.1543_9; > > a_10 = a_3 + 3; > > b_11 = b_1 + 3; > > D.1543_12 = *b_11; > > *a_10 = D.1543_12; > > a_13 = a_3 + 4; > > b_14 = b_1 + 4; > > D.1543_15 = *b_14; > > *a_13 = D.1543_15; > > > > etc.; I am fairly sure we used to do this. > > I guess FRE did this in former times. While current VN figures this out, > it doesn't do the replacement: > > Value numbering a_10 stmt = a_10 = a_7 + 1; > RHS a_7 + 1 simplified to a_3(D) + 3 has constants 0 > Setting value number of a_10 to a_10 > > Danny, is this an oversight?
FRE currently will only try to replace with an existing SSA_NAME, not with an expression. It probably should, since it will help eliminate dead code if it does.