[Bug rtl-optimization/42612] post-increment addressing not used

steven at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jan 4 18:53:00 GMT 2010



------- Comment #1 from steven at gcc dot gnu dot org  2010-01-04 18:53 -------
>From the tree optimizers we go to expand with the following code (from
PR42612.c.139t.optimized):

;; Function func (func)

func (char * p)
{
<bb 2>:
  *p_1(D) = 0;
  p_2 = p_1(D) + 1;
  *p_2 = 0;
  p_3 = p_2 + 1;
  *p_3 = 0;
  p_4 = p_3 + 1;
  return p_4;

}



The code remains in this form until combine, which changes the code as follows
(left is PR42612.c.174r.dce, right is PR42612.c.175r.combine, dumped with
-fdump-rtl-all-slim):

    4 NOTE_INSN_BASIC_BLOCK                 4 NOTE_INSN_BASIC_BLOCK
    2 r137:SI=r0:SI                         2 r137:SI=r0:SI
      REG_DEAD: r0:SI                         REG_DEAD: r0:SI
    3 NOTE_INSN_FUNCTION_BEG                3 NOTE_INSN_FUNCTION_BEG
    6 r138:SI=0x0                           6 r138:SI=0x0
   28 r133:SI=r137:SI                      28 r133:SI=r137:SI
    8 [r133:SI++]=r138:SI#0                 8 [r133:SI++]=r138:SI#0
      REG_INC: r133:SI                        REG_INC: r133:SI
      REG_EQUAL: 0x0                          REG_EQUAL: 0x0
   12 [r137:SI+0x1]=r138:SI#0              12 [r137:SI+0x1]=r138:SI#0
      REG_DEAD: r137:SI                       REG_DEAD: r137:SI
      REG_EQUAL: 0x0                          REG_EQUAL: 0x0
   13 r134:SI=r133:SI+0x1             |    13 NOTE_INSN_DELETED
   16 [r133:SI+0x1]=r138:SI#0              16 [r133:SI+0x1]=r138:SI#0
      REG_DEAD: r138:SI                       REG_DEAD: r138:SI
      REG_DEAD: r133:SI               <
      REG_EQUAL: 0x0                          REG_EQUAL: 0x0
   17 r144:SI=r134:SI+0x1             |    17 NOTE_INSN_DELETED
      REG_DEAD: r134:SI               |    22 r0:SI=r133:SI+0x2
   22 r0:SI=r144:SI                   |       REG_DEAD: r133:SI
      REG_DEAD: r144:SI               <
   25 use r0:SI                            25 use r0:SI

Paolo, you know combine best. Is there a way, you think, to teach combine about
post-increment addressing?


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bonzini at gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-04 18:53:12
               date|                            |


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



More information about the Gcc-bugs mailing list