On 12/1/2014 11:57 AM, Jeff Law wrote:
Prior to reload (ie, in DSE1) there's a bit of magic in that we do not set frame_read on call insns. That may in fact be wrong and possibly the source of the problem.

 /* This field is only used for the processing of const functions.
     These functions cannot read memory, but they can read the stack
     because that is where they may get their parms.  We need to be
     this conservative because, like the store motion pass, we don't
     consider CALL_INSN_FUNCTION_USAGE when processing call insns.
     Moreover, we need to distinguish two cases:
     1. Before reload (register elimination), the stores related to
        outgoing arguments are stack pointer based and thus deemed
        of non-constant base in this pass.  This requires special
        handling but also means that the frame pointer based stores
        need not be killed upon encountering a const function call.
     2. After reload, the stores related to outgoing arguments can be
        either stack pointer or hard frame pointer based.  This means
        that we have no other choice than also killing all the frame
        pointer based stores upon encountering a const function call.
     This field is set after reload for const function calls. Having
     this set is less severe than a wild read, it just means that all
     the frame related stores are killed rather than all the stores.  */
  bool frame_read;


As a test, what happens if we change:


          /* See the head comment of the frame_read field.  */
          if (reload_completed)
            insn_info->frame_read = true;

To do unconditionally set frame_read? Or if we don't want to get that drastic,

if (reload_completed || SIBLING_CALL_P (insn))
  insn_info->frame_read = true;
Will test but I, if I read the code correctly, setting insn_info->frame_read = true results in frame related stores being killed in a constant call. This doesn't seem
like the right solution.

Here we have frame related calls being killed before reload because the argument
stores for the sibcall are off frame:

/* Set the gen set of the exit block, and also any block with no
   successors that does not have a wild read.  */

static void
dse_step3_exit_block_scan (bb_info_t bb_info)
{
  /* The gen set is all 0's for the exit block except for the
     frame_pointer_group.  */

  if (stores_off_frame_dead_at_return)
    {
      unsigned int i;
      group_info_t group;

      FOR_EACH_VEC_ELT (rtx_group_vec, i, group)
        {
          if (group->process_globally && group->frame_related)
            bitmap_ior_into (bb_info->gen, group->group_kill);
        }
    }
}

Dave

--
John David Anglin    dave.ang...@bell.net

Reply via email to