On Wed, Jun 4, 2014 at 8:46 AM, Jeff Law <l...@redhat.com> wrote: > On 06/03/14 03:29, Richard Biener wrote: >> >> On Tue, Jun 3, 2014 at 7:55 AM, Ilya Enkovich <enkovich....@gmail.com> >> wrote: >>> >>> 2014-06-02 21:27 GMT+04:00 Jeff Law <l...@redhat.com>: >>>> >>>> On 06/02/14 04:48, Ilya Enkovich wrote: >>>>>> >>>>>> >>>>>> Hmm, so if I understand things correctly, src_fun has no loop >>>>>> structures attached, thus there's nothing to copy. Presumably at >>>>>> some later point we build loop structures for the copy from scratch? >>>>> >>>>> >>>>> I suppose it is just a simple bug with absent NULL pointer check. Here >>>>> is >>>>> original code: >>>>> >>>>> /* Duplicate the loop tree, if available and wanted. */ >>>>> if (loops_for_fn (src_cfun) != NULL >>>>> && current_loops != NULL) >>>>> { >>>>> copy_loops (id, entry_block_map->loop_father, >>>>> get_loop (src_cfun, 0)); >>>>> /* Defer to cfgcleanup to update loop-father fields of >>>>> basic-blocks. */ >>>>> loops_state_set (LOOPS_NEED_FIXUP); >>>>> } >>>>> >>>>> /* If the loop tree in the source function needed fixup, mark the >>>>> destination loop tree for fixup, too. */ >>>>> if (loops_for_fn (src_cfun)->state & LOOPS_NEED_FIXUP) >>>>> loops_state_set (LOOPS_NEED_FIXUP); >>>>> >>>>> As you may see we have check for absent loops structure in the first >>>>> if-statement and no check in the second one. I hit segfault and added >>>>> the >>>>> check. >>>> >>>> >>>> Downthread you indicated you're not in SSA form which might explain the >>>> inconsistency here. If so, then we need to make sure that the loop & df >>>> structures do get set up properly later. >>> >>> >>> That is what init_data_structures pass will do for us as Richard pointed. >>> Right? >> >> >> loops are set up during the CFG construction and thus are available >> everywhere. > > Which would argue that the hunk that checks for the loop tree's existence > before accessing it should not be needed. Ilya -- is it possible you hit > this prior to Richi's work to build the loop structures as part of CFG > construction and maintain them throughout compilation.
That's likely. It's still on my list of janitor things to do to remove all those if (current_loops) checks ... >> the df structures are set up in init_data_structures pass which is run >> before >> going into SSA form (I'd like to somehow cleanup that area). > > OK. So this part should be approved since we've established this code is > running prior to going into SSA form. Agreed. Thanks, Richard. > jeff >