This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, ARM] Don't copy uncopyable instructions in gcse.c


> Tests (cross to ARM Linux with march=armv7-a/mthumb) with this version
> look reasonable (though I can't do a before/after regression check for
> obvious reasons).

I think that adding the check to can_assign_to_reg_without_clobbers_p is more 
general and better.  So I'd would change this function as follows:

/* Return true if we can assign X to a pseudo register such that the
   resulting insn does not result in clobbering a hard register as a
   side-effect.

   Additionally, if the target requires it, check that the resulting insn
   can be copied.  If it cannot, this means that X is special and probably
   has hidden side-effects we don't want to mess with.

   This function is typically used by code motion passes, to verify
   that it is safe to insert an insn without worrying about clobbering
   maybe live hard regs.  */

bool
can_assign_to_reg_without_clobbers_p (rtx x)
{
[...]

  /* Now make an insn like the one we would make when GCSE'ing and see if
     valid.  */
  PUT_MODE (SET_DEST (PATTERN (test_insn)), GET_MODE (x));
  SET_SRC (PATTERN (test_insn)) = x;

  icode = recog (PATTERN (test_insn), test_insn, &num_clobbers));
  if (icode <0)
    return false;

  if (num_clobbers > 0 && added_clobbers_hard_reg_p (icode))
    return false;

  if (targetm.cannot_copy_insn_p
      && [...]
    return false;

  return true;
}


OK for mainline with this change if that still solves your problem.

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]