https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63616

            Bug ID: 63616
           Summary: PRE failure
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com
            Target: alpha-linux-gnu

Currently text/template/parse testcase from libgo fails on alpha-linux-gnu due
to failure of PRE pass.

Before PRE pass, we have:

  409: r229:DI=[FP:DI+0x60]
  410: pc={(r229:DI==0)?L437:pc}
      REG_DEAD r229:DI
      REG_BR_PROB 1500
  ...
  427: L427:                                   [***] <--- jump target
  428: NOTE_INSN_BASIC_BLOCK 33
  430: r236:SI=[r70:DI+0x10]                   <--- load from r70+0x10
  431: r235:QI#0=zero_extract(r236:SI#0,0x8,0)
      REG_DEAD r236:SI
  432: r95:DI=zero_extend(r235:QI)
      REG_DEAD r235:QI
  433: pc={(r95:DI!=0)?L458:pc}
      REG_DEAD r95:DI
      REG_BR_PROB 5000
  437: L437:
  438: NOTE_INSN_BASIC_BLOCK 34
  439: r237:QI=0x1
  440: r238:SI=[r70:DI+0x10]                   <--- load from r70+0x10
  441: r238:SI#0=r238:SI#0&0xffffffffffffff00
  443: r239:SI#0=r238:SI#0|0x1
      REG_DEAD r238:SI
  444: [r70:DI+0x10]=r239:SI                   <--- store to r70+0x10
      REG_DEAD r239:SI
  445: [r70:DI+0x18]=r94:DI
  446: pc={(r94:DI!=0)?L427:pc}                jump back ---> [***]
      REG_DEAD r94:DI
      REG_BR_PROB 5000
  ...

PRE pass eliminates load to:

  ...
  409: r229:DI=[FP:DI+0x60]
  410: pc={(r229:DI==0)?L437:pc}
      REG_DEAD r229:DI
      REG_BR_PROB 1500
  708: NOTE_INSN_BASIC_BLOCK 30
  699: r307:SI=[r70:DI+0x10]                   <--- load to temp from r70+0x10
  ...
  427: L427:                                   [***] <--- jump target
  428: NOTE_INSN_BASIC_BLOCK 32
  698: r236:SI=r307:SI                         <--- move from temp
      REG_EQUAL [r70:DI+0x10]
  431: r235:QI#0=zero_extract(r236:SI#0,0x8,0)
      REG_DEAD r236:SI
  432: r95:DI=zero_extend(r235:QI)
      REG_DEAD r235:QI
  433: pc={(r95:DI!=0)?L458:pc}
      REG_DEAD r95:DI
      REG_BR_PROB 5000
  437: L437:
  438: NOTE_INSN_BASIC_BLOCK 33
  439: r237:QI=0x1
  440: r307:SI=[r70:DI+0x10]                   <--- load to temp from r70+0x10
  707: r238:SI=r307:SI                         <--- move from temp
  441: r238:SI#0=r238:SI#0&0xffffffffffffff00
  443: r239:SI#0=r238:SI#0|0x1
      REG_DEAD r238:SI
  444: [r70:DI+0x10]=r239:SI                   <--- store to r70+0x10
      REG_DEAD r239:SI
  445: [r70:DI+0x18]=r94:DI
  446: pc={(r94:DI!=0)?L427:pc}                jump back ---> [***]
      REG_DEAD r94:DI
      REG_BR_PROB 5000
  ...

As shown above, PRE inserted BB 30, but when progam jumps back, the value is
moved from temporary, not from the memory. It looks that when a new BB is
inserted, the compiler forgot to update the jumpback label.

I will attach complete cprop1 and pre dumps. I didn't find any kind of
"preprocessed" go file with -fsave-temps to attach.

Reply via email to