peephole eliminating register use: how to not ICE?

Michael Poole poole@troilus.org
Thu Apr 12 10:33:00 GMT 2001


I'm working on a port of GCC (using gcc-3_0-branch, updated as of this
morning) to a new platform, and on one source file we get an ICE.

mpls.c: In function `process_segments':
mpls.c:1190: Internal compiler error in print_rtl_and_abort, at flow.c:6631
Please submit a full bug report, with preprocessed source if appropriate.
See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.

I look at the RTL dump files from "gcc -da", and find the following
error in mpls.c.25.sched2 (which is printed right before the call to
print_rtl_and_abort, which aborts at flow.c:6631):

  live_at_start mismatch in bb 13, aborting

  first = 377e74 current = 377e74 indx = 0
          377e74 next = 0 prev = 0 indx = 0
                  bits = { 2 6 18 19 20 21 23 24 25 26 27 30
                           31 33 34 }

  first = 3764fc current = 3764fc indx = 0
          3764fc next = 0 prev = 0 indx = 0
                  bits = { 2 6 9 18 19 20 21 23 24 25 26 27
                           30 31 33 34 }

I assume that the complaint is because register 9 was added in the
second regset (from verify_local_live_at_start, the new_live_at_start
set) but not in the first (new_live_at_start).

So, digging back through the earlier dump files, I look to see when R9
was last used in that basic block.  One of the peepholes removed it --
in mpls.c.21.flow2, I see:

  (insn 260 261 262 (set (reg/v:QI 9 R9 [73])
          (zero_extract:QI (reg:QI 2 R2 [100])
              (const_int 8 [0x8])
              (const_int 24 [0x18]))) 35 {extzv} (nil)
      (expr_list:REG_DEAD (reg:QI 2 R2 [100])
          (nil)))

  (insn:QI 262 260 263 (set (cc0)
          (compare (reg/v:QI 9 R9 [73])
              (const_int 1 [0x1]))) 31 {cmpqi} (insn_list 260 (insn_list 260 (nil)))
      (nil))

  (jump_insn/s 263 262 266 (set (pc)
          (if_then_else (gtu (cc0)
                  (const_int 0 [0x0]))
              (label_ref 318)
              (pc))) 49 {bgtu} (insn_list 260 (nil))
      (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
          (nil)))

and in mpls.c.22.peephole2, the corresponding insns are:

  (insn 3991 261 3992 (set (cc0)
          (compare (sign_extract:QI (reg:QI 2 R2 [100])
                  (const_int 8 [0x8])
                  (const_int 24 [0x18]))
              (const_int 1 [0x1]))) -1 (nil)
      (expr_list:REG_DEAD (reg:QI 2 R2 [100])
          (nil)))

  (jump_insn 3992 3991 266 (set (pc)
          (if_then_else (gtu (cc0)
                  (const_int 0 [0x0]))
              (label_ref 318)
              (pc))) -1 (nil)
      (nil))

So it appears that the peephole removed the register use, but nothing
caught that fact until its elimination caused an ICE.  How can I tell
the rest of the compiler that, after the peephole is applied, the
register is not actually created or used?

(On the other hand, maybe I'm misunderstanding why these insns give
gcc heartburn.  If that's the case, suggestions on where to look next
would be appreciated.)

-- Michael



More information about the Gcc mailing list