optimization/3648: regrename pass causes ICE in verify_local_live_at_start

apl@alum.mit.edu apl@alum.mit.edu
Wed Jul 11 07:36:00 GMT 2001


>Number:         3648
>Category:       optimization
>Synopsis:       regrename causes ICE in verify_local_live_at_start
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 11 07:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.1 20010628 (experimental)
>Organization:
Quality Software Management
>Environment:
>Description:

Compiling a simple program with -O3 results in ICE.

It appears that regrename incorrectly renames references to R1 into
references to R2 without fixing ALL such related references.
	
This results in USES of R2 without any initialization.  Eventually we
try to recompute the flow information and die with

	 Internal compiler error in verify_local_live_at_start, at flow.c:3340

My compiler uses splitting to load immediate values in order to
maintain the actual constant value for optimization as late as
possible.  So, there are define_splits that replace a single SET with
the two instruction sequence to load the two halves.  That's done so
that each of the instructions is a candidate for delay-slots.

    (define_insn_and_split "*move-imm-2"
      [(set (match_operand:QI 0 "tpc_non_imm_operand" "=rS")
	    (match_operand:QI 1 "immed_two_insn_operand" "i"))]
      ""
      "#"
      "reload_completed"
      [(set (match_dup 2) (match_dup 3))
       (set (match_dup 4) (match_dup 5))]
      "tpc_split_load (operands);"
    )

This is occurring with a source tree that's current against the
development tree as of July 7, 2001.

>How-To-Repeat:

	
Here's the program

    regx0adrreg1 (r0, r1, x0, x1, p0, p1)
    unsigned int r0, r1;  unsigned int *p0, *p1;
    {
      if ((p1[x1]) <= (p1[1111111/4]))
	return 1;
      else
	return 0;
    }

=================================================
And the RTL just before the rename phase.  Look specifically at
INSNs 67 and 68 which load R1 with a 32 bit constant in two pieces.
In rename, we have replaced the USES in INSN 68 by R2, but note that
INSN 67 still stores into R1




;; Function regx0adrreg1

(note 1 0 56 ("/export/home/lehotsky/reg.c") 3)

;; Start of basic block 0, registers live: 0 [r0] 5 [r5] 7 [r7] 19 [sp]
(note 56 1 10 [bb 0] NOTE_INSN_BASIC_BLOCK)

(insn 10 56 14 (set (reg/v:QI 18 ptr2 [31])
        (reg:QI 5 r5)) 11 {*movqi} (nil)
    (expr_list:REG_DEAD (reg:QI 5 r5)
        (nil)))

(insn 14 10 15 (set (reg/v/f:QI 17 ptr1 [33])
        (reg:QI 7 r7)) 11 {*movqi} (nil)
    (expr_list:REG_DEAD (reg:QI 7 r7)
        (nil)))

(note 15 14 19 NOTE_INSN_FUNCTION_BEG)

(note 19 15 21 ("/export/home/lehotsky/reg.c") 4)

(insn 21 19 25 (set (reg/f:QI 18 ptr2 [34])
        (plus:QI (reg/v/f:QI 17 ptr1 [33])
            (reg/v:QI 18 ptr2 [31]))) 14 {*tpc.md:754} (insn_list 10 (insn_list 14 (insn_list 10 (insn_list 14 (nil)))))
    (nil))

(note 25 21 67 NOTE_INSN_DELETED)

(insn 67 25 68 (set (reg:QI 1 r1)
        (const_int 15633 [0x3d11])) 11 {*movqi} (nil)
    (nil))

(insn 68 67 27 (set (reg:QI 1 r1)
        (ior:QI (reg:QI 1 r1)
            (const_int 262144 [0x40000]))) 18 {*bis} (insn_list 67 (nil))
    (nil))

(insn 27 68 34 (set (reg/v/f:QI 17 ptr1 [33])
        (plus:QI (reg/v/f:QI 17 ptr1 [33])
            (reg:QI 1 r1))) 14 {*tpc.md:754} (insn_list 68 (nil))
    (expr_list:REG_DEAD (reg:QI 1 r1)
        (nil)))

(insn 34 27 28 (set (reg:QI 1 r1 [27])
        (const_int 1 [0x1])) 11 {*movqi} (nil)
    (nil))

(insn:QI 28 34 29 (set (cc0)
        (compare (mem:QI (reg/f:QI 18 ptr2 [34]) 0)
            (mem:QI (reg/v/f:QI 17 ptr1 [33]) 0))) 50 {cmpqi} (insn_list 21 (insn_list 27 (insn_list 21 (insn_list 27 (nil)))))
    (expr_list:REG_DEAD (reg/f:QI 18 ptr2 [34])
        (expr_list:REG_DEAD (reg/v/f:QI 17 ptr1 [33])
            (nil))))

(jump_insn 29 28 30 (set (pc)
        (if_then_else (leu (cc0)
                (const_int 0 [0x0]))
            (label_ref 50)
            (pc))) 52 {*condjump} (nil)
    (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
        (nil)))
;; End of basic block 0, registers live:
 0 [r0] 1 [r1] 19 [sp]

(note 30 29 40 ("/export/home/lehotsky/reg.c") 5)

(note 40 30 58 ("/export/home/lehotsky/reg.c") 7)

;; Start of basic block 1, registers live: 0 [r0] 19 [sp]
(note 58 40 44 [bb 1] NOTE_INSN_BASIC_BLOCK)

(insn 44 58 49 (set (reg:QI 1 r1 [27])
        (const_int 0 [0x0])) 11 {*movqi} (nil)
    (expr_list:REG_EQUAL (const_int 0 [0x0])
        (nil)))
;; End of basic block 1, registers live:
 0 [r0] 1 [r1] 19 [sp]

(note 49 44 50 ("/export/home/lehotsky/reg.c") 8)

;; Start of basic block 2, registers live: 0 [r0] 1 [r1] 19 [sp]
(code_label 50 49 59 1 "" "" [1 uses])

(note 59 50 52 [bb 2] NOTE_INSN_BASIC_BLOCK)

(insn 52 59 55 (use (reg/i:QI 1 r1)) -1 (nil)
    (nil))

(insn 55 52 63 (use (reg/i:QI 1 r1)) -1 (insn_list 52 (nil))
    (nil))
;; End of basic block 2, registers live:
 0 [r0] 1 [r1] 19 [sp]

(note 63 55 0 NOTE_INSN_DELETED)

================================================================
And the dump after the ICE in renaming


;; Function regx0adrreg1


Basic block 0:
Closing chain ptr2 at insn 21 (terminate_write)
Closing chain r1 at insn 68 (terminate_write)
Closing chain r1 at insn 27 (terminate_dead)
Closing chain r1 at insn 27 (terminate_dead)
Closing chain ptr2 at insn 28 (terminate_dead)
Closing chain ptr1 at insn 28 (terminate_dead)
Register ptr1 (1): 14 [GENERAL_REGS] 21 [GENERAL_REGS] 27 [GENERAL_REGS] 27 [GENERAL_REGS] 28 [PTR_REGS]
Register ptr2 (1): 21 [GENERAL_REGS] 28 [PTR_REGS]
Register r1 (1): 68 [GENERAL_REGS]
Register r1 (1): 68 [GENERAL_REGS] 27 [GENERAL_REGS]
Register r1 (1): 67 [GENERAL_REGS]
Register ptr2 (1): 10 [GENERAL_REGS] 21 [GENERAL_REGS]
Register ptr1 in insn 28; no available registers
Register ptr2 in insn 28; no available registers
Register r1 in insn 27, renamed as r2
Register ptr2 in insn 21, renamed as r1

Basic block 1:

Basic block 2:

live_at_start mismatch in bb 0, aborting

first = 4d8bdc current = 4d8bdc indx = 0
	4d8bdc next = 0 prev = 0 indx = 0
		bits = { 0 5 7 19 }

first = 4d8bc8 current = 4d8bc8 indx = 0
	4d8bc8 next = 0 prev = 0 indx = 0
		bits = { 0 2 5 7 19 }
(note 1 0 56 ("/export/home/lehotsky/reg.c") 3)

;; Start of basic block 0, registers live: 0 [r0] 5 [r5] 7 [r7] 19 [sp]
(note 56 1 10 [bb 0] NOTE_INSN_BASIC_BLOCK)

(insn 10 56 14 (set (reg:QI 1 r1 [31])
        (reg:QI 5 r5)) 11 {*movqi} (nil)
    (expr_list:REG_DEAD (reg:QI 5 r5)
        (nil)))

(insn 14 10 15 (set (reg/v/f:QI 17 ptr1 [33])
        (reg:QI 7 r7)) 11 {*movqi} (nil)
    (expr_list:REG_DEAD (reg:QI 7 r7)
        (nil)))

(note 15 14 19 NOTE_INSN_FUNCTION_BEG)

(note 19 15 21 ("/export/home/lehotsky/reg.c") 4)

(insn 21 19 25 (set (reg/f:QI 18 ptr2 [34])
        (plus:QI (reg/v/f:QI 17 ptr1 [33])
            (reg:QI 1 r1 [31]))) 14 {*tpc.md:754} (insn_list 10 (insn_list 14 (insn_list 10 (insn_list 14 (nil)))))
    (expr_list:REG_DEAD (reg:QI 1 r1 [31])
        (nil)))

(note 25 21 67 NOTE_INSN_DELETED)

(insn 67 25 68 (set (reg:QI 1 r1)
        (const_int 15633 [0x3d11])) 11 {*movqi} (nil)
    (expr_list:REG_UNUSED (reg:QI 1 r1)
        (nil)))

(insn 68 67 27 (set (reg:QI 1 r1)
        (ior:QI (reg:QI 2 r2)
            (const_int 262144 [0x40000]))) 18 {*bis} (insn_list 67 (nil))
    (expr_list:REG_UNUSED (reg:QI 1 r1)
        (nil)))

(insn 27 68 34 (set (reg/v/f:QI 17 ptr1 [33])
        (plus:QI (reg/v/f:QI 17 ptr1 [33])
            (reg:QI 2 r2))) 14 {*tpc.md:754} (insn_list 68 (nil))
    (expr_list:REG_DEAD (reg:QI 2 r2)
        (nil)))

(insn 34 27 28 (set (reg:QI 1 r1 [27])
        (const_int 1 [0x1])) 11 {*movqi} (nil)
    (nil))

(insn:QI 28 34 29 (set (cc0)
        (compare (mem:QI (reg/f:QI 18 ptr2 [34]) 0)
            (mem:QI (reg/v/f:QI 17 ptr1 [33]) 0))) 50 {cmpqi} (insn_list 21 (insn_list 27 (insn_list 21 (insn_list 27 (nil)))))
    (expr_list:REG_DEAD (reg/f:QI 18 ptr2 [34])
        (expr_list:REG_DEAD (reg/v/f:QI 17 ptr1 [33])
            (nil))))

(jump_insn 29 28 30 (set (pc)
        (if_then_else (leu (cc0)
                (const_int 0 [0x0]))
            (label_ref 50)
            (pc))) 52 {*condjump} (nil)
    (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
        (nil)))
;; End of basic block 0, registers live:
 0 [r0] 1 [r1] 19 [sp]

(note 30 29 40 ("/export/home/lehotsky/reg.c") 5)

(note 40 30 58 ("/export/home/lehotsky/reg.c") 7)

;; Start of basic block 1, registers live: 0 [r0] 19 [sp]
(note 58 40 44 [bb 1] NOTE_INSN_BASIC_BLOCK)

(insn 44 58 49 (set (reg:QI 1 r1 [27])
        (const_int 0 [0x0])) 11 {*movqi} (nil)
    (expr_list:REG_EQUAL (const_int 0 [0x0])
        (nil)))
;; End of basic block 1, registers live:
 0 [r0] 1 [r1] 19 [sp]

(note 49 44 50 ("/export/home/lehotsky/reg.c") 8)

;; Start of basic block 2, registers live: 0 [r0] 1 [r1] 19 [sp]
(code_label 50 49 59 1 "" "" [1 uses])

(note 59 50 52 [bb 2] NOTE_INSN_BASIC_BLOCK)

(insn 52 59 55 (use (reg/i:QI 1 r1)) -1 (nil)
    (nil))

(insn 55 52 63 (use (reg/i:QI 1 r1)) -1 (insn_list 52 (nil))
    (nil))
;; End of basic block 2, registers live:
 0 [r0] 1 [r1] 19 [sp]

(note 63 55 0 NOTE_INSN_DELETED)



>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
 X-send-pr-version: 3.113
 System: SunOS iron 5.7 Generic_106541-02 sun4u sparc SUNW,Ultra-5_10
 Architecture: sun4
 
 	
 host: sparc-sun-solaris2.7
 build: sparc-sun-solaris2.7
 target: tpc-unknown-elf
 configured with: /export/home/lehotsky/basel/configure --target=tpc-elf --enable-languages=c --with-gnu-as --with-gnu-ld --enable-maintainer-mode --enable-cgen-maint --with-newlib : (reconfigured) /export/home/lehotsky/basel/configure --target=tpc-elf -- enable-languages=c --with-gnu-as --with-gnu-ld --enable-maintainer-mode --enable-cgen-maint --with-newlib --disable-nls : (reconfigured) /export/home/lehotsky/basel/configure --with-gcc-version-trigger=/export/home/lehotsky/basel/gcc/version.c --host=spa rc-sun-solaris2.7 --target=tpc-elf --enable-languages=c --with-gnu-as --with-gnu-ld --enable-maintainer-mode --enable-cgen-maint --with-newlib --disable-nls : (reconfigured) 



More information about the Gcc-bugs mailing list