On Wed, 15 Jul 2015, Andrew MacLeod wrote: > On 07/15/2015 03:01 PM, Jeff Law wrote: > > On 07/14/2015 05:37 AM, Richard Biener wrote: > > > On Tue, 14 Jul 2015, Richard Biener wrote: > > > > > > > > > > > Applied. The following patch adds the equivalences for the destination > > > > of use stmts if they simplify. > > > > > > Actually I can't use FOR_EACH_IMM_USE_STMT any longer because > > > record_equivalence ends up calling has_single_use which doens't > > > handle the special marker FOR_EACH_IMM_USE_STMT inserts. > > hmm, that is unfortunate... and seems almost like a bug to me... Maybe that > should be fixed?
Not sure - FOR_EACH_IMM_USE_STMT is really special here and all the other immediate use helpers shouldn't pay an extra performance penalty for that special marker. But I didn't search for existing cases of handling it. > And doesn't that also mean num_imm_uses() has a latent bug if used during a > FOR_EACH_IMM_USE_STMT ? Yes. > admittedly neither situation is very common I suspect, but it does seem like a > hidden gotchya waiting to happen. I guess we either want to checking-assert that we never hit that special marker or handle it appropriately. Or even better avoid it in the first place (not sure why we have it - I suppose to allow modifying immediate uses of the current stmt from inside FOR_EACH_IMM_USE_STMT). For me single_imm_use_1 crashed on the NULL USE_STMT at if (!is_gimple_debug (USE_STMT (ptr))) so I presume all was fine until debug stmts were introduced (well, fine as in not crashing, not as in giving correct answers). Richard. > Andrew > > > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nuernberg)