> On Fri, Oct 12, 2012 at 9:43 PM, Jan Hubicka <hubi...@ucw.cz> wrote: > > Hi, > > I finally tracked down twolf misoptimization triggered by my loop-unroll.c > > changes. It has turned out to be semi-latent wrong code issue in webizer. > > What happens is: > > > > 1) gcse.c drop REG_EQUAL note on the induction variable > > 2) loop optimizer unrolls the loop enabling webizer to cleanup > > 3) webizer do not track reaching refs into REG_EQUAL note because > > the variable is dead and renames it to unused pseudo > > Program is stil valid but the REG_EQUAL is bogus. > > What do you mean, "not track"? web.c does track EQ notes via DF this: > > web.c:315: df_set_flags (DF_NO_HARD_REGS + DF_EQ_NOTES); > > This is bogus. You're papering over the underlying bug of an invalid > REG_EQUAL note. This patch is not OK!
The REG_EQUAL note is valid until webizer breaks it. DF_EQ_NOTES makes UD chain problem to look into uses of REG_EQUAL and add all reaching definitions into the list. To do the reaching definitions it uses RD problem solution. This solution do not really care about REG_EQUAL notes because it does only over definitions. It however uses results of LIVENESS problem via REG_DEAD notes and the pruning trick. Now th REG_EQUAL note uses dead register (that is aloved), because the liveness is computed ignoring REG_EQUAL notes and thus the definition gets prunned from the list and consequentely webizer misses the link. > > I did not add DF_RD_PRUNE_DEAD_DEFS for no reason. You're > re-introducing a major compile time hog. Did you do timings on some > significant body of code with -fweb enabled? Well, I can not think how to fix it without 1) computing liveness with REG_EQUAL included prior RD that means a lot of shuffling of REG_DEAD notes 2) making webizer to drop all REG_EQUAL notes that use dead register (for that it will need to track liveness too) Do you have better ideas? Honza > > Ciao! > Steven