Hi,
I encountered below example,

<bb x>
   79: r169:SI=r190:SI<<0x2

<bb y>
  115: r180:SI=r180:SI+r169:SI
  116: cc:CC=cmp(r181:SI,r190:SI)
  117: pc={(cc:CC==0)?L125:pc}

The register r169 is only defined by insn79, so I was hoping the
reference in insn115 can be replaced by "r190<<0x2", thus saving one
instruction and one live pseudo register.

Problem is fwprop pass doesn't do this now because function
propagate_rtx_1 only returns true if PR_CAN_APPEAR is set, which is
not in this case because of below code in propagate_rtx:


  flags = 0;
  if (REG_P (new_rtx)
      || CONSTANT_P (new_rtx)
      || (GET_CODE (new_rtx) == SUBREG
      && REG_P (SUBREG_REG (new_rtx))
      && (GET_MODE_SIZE (mode)
          <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (new_rtx))))))
    flags |= PR_CAN_APPEAR;
  if (!for_each_rtx (&new_rtx, varying_mem_p, NULL))
    flags |= PR_HANDLE_MEM;

  if (speed)
    flags |= PR_OPTIMIZE_FOR_SPEED;

I did experiment by setting PR_CAN_APPEAR here but fwprop doesn't work
correctly any more.

So question is Why we don't do such transformation in fwprop pass and
how should this be handled?

Thanks very much.

--
Best Regards.

Reply via email to