Gentlepeople,

I'm using Eric Botcazou's recipe #2 for the CCmode version of pdp11 -- where 
most instructions step on the condition codes so the CC references are inserted 
post-reload.  As part of that, the compare-elim pass gets rid of compares that 
are redundant given that the instruction before it already set the CC correctly.

If I do that I get an ICE in cselib that I can't figure out.  If I turn off the 
post-reload compare elimination optimization then everything works.  

The error is this:

during RTL pass: dse2
dump file: unwind-dw2-fde.c.288r.dse2
../../../../gcc/libgcc/unwind-dw2-fde.c: In function ‘get_cie_encoding’:
../../../../gcc/libgcc/unwind-dw2-fde.c:342:1: internal compiler error: in 
cselib_record_set, at cselib.c:2409
 }
 ^

I don't understand what it's looking for or why it is unhappy.

The RTL that blows up, as reported in the 288r.dse dump file, looks like this:

(insn 195 194 197 11 (parallel [
            (set (reg:CC 16 cc)
                (compare:CC (mem:QI (post_inc:HI (reg/v/f:HI 0 r0 [orig:41 p ] 
[41])) [0 MEM[base: p_38, offset: 65535B]+0 S1 A8])
                    (const_int 0 [0])))
            (set (reg:QI 2 r2 [orig:38 byte.10_40 ] [38])
                (mem:QI (post_inc:HI (reg/v/f:HI 0 r0 [orig:41 p ] [41])) [0 
MEM[base: p_38, offset: 65535B]+0 S1 A8]))
        ]) "../../../../gcc/libgcc/unwind-pe.h":166 20 {*mov_ccqi}
     (expr_list:REG_UNUSED (reg:QI 2 r2 [orig:38 byte.10_40 ] [38])
        (expr_list:REG_UNUSED (reg/v/f:HI 0 r0 [orig:41 p ] [41])
            (expr_list:REG_INC (reg/v/f:HI 0 r0 [orig:41 p ] [41])
                (nil)))))

I wonder if the REG_UNUSED is the issue?  The input to the compare elimination 
pass looks like this:

(insn 195 194 196 11 (parallel [
            (set (reg:QI 2 r2 [orig:38 byte.10_40 ] [38])
                (mem:QI (post_inc:HI (reg/v/f:HI 0 r0 [orig:41 p ] [41])) [0 
MEM[base: p_38, offset: 65535B]+0 S1 A8]))
            (clobber (reg:CC 16 cc))
        ]) "../../../../gcc/libgcc/unwind-pe.h":166 18 {*mov_noccqi}
     (expr_list:REG_INC (reg/v/f:HI 0 r0 [orig:41 p ] [41])
        (nil)))
(insn 196 195 197 11 (set (reg:CC 16 cc)
        (compare:CC (reg:QI 2 r2 [orig:38 byte.10_40 ] [38])
            (const_int 0 [0]))) "../../../../gcc/libgcc/unwind-pe.h":166 7 
{*cmpqi}
     (nil))

and the compare (insn 196) was eliminated because there is a pattern for that 
load operation that sets CC the right way.  However... the only reason the load 
was done was to provide the input to the compare.  So by eliminating the 
compare, the load no longer serves a purpose, as indicated by the REG_UNUSED 
note in the DSE output.  Is that why it complained? 

If that's the issue, what can I do to make it go away?  One answer would be not 
to have that load; the compare can accept a memory operand just fine, 
presumably the costs need adjusting.  But it seems a bit odd to rely on costs 
to avoid an ICE.

        paul

Reply via email to