http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43491

amker.cheng <amker.cheng at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amker.cheng at gmail dot
                   |                            |com

--- Comment #2 from amker.cheng <amker.cheng at gmail dot com> 2011-11-23 
05:50:51 UTC ---
Noticed that pass 097t.copyprop4 propagates reg.0_12 to statement Y in
following dump:
-------------------------------------
<bb 2>:
  reg.0_12 = reg;
  D.4705_13 = MEM[(unsigned int *)reg.0_12 + 8B];   <-----statement Z
  if (D.4705_13 != 0)
    goto <bb 3>;
  else
    goto <bb 6>;

<bb 3>:

<bb 4>:
  c ();
  reg.0_1 = reg.0_12;                                                 
<-----statement X
  D.4705_3 = MEM[(unsigned int *)reg.0_1 + 8B]; <-----statement Y
  if (D.4705_3 != 0)
    goto <bb 5>;
  else
    goto <bb 6>;

<bb 5>:
  goto <bb 4>;

<bb 6>:
  return;
-------------------------------------
to be:
  reg.0_1 = reg.0_12;                                                  
<-----statement X
  D.4705_3 = MEM[(unsigned int *)reg.0_12 + 8B]; <-----statement Y

So, should it propagates reg directly? Could this be done on ssa?

Also I found 
1) there are similar cases on redundant copy or load constant, for example,
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44025
2) some of these cases are generated after expanding into rtl;
3) redundant copy might be handled in IRA, but redundant load const might be
more difficult.

How about extending regcprop.c pass into a global pass?

Reply via email to