This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug bootstrap/69727] [6 Regression] ICE in profiledbootstrap in reg_save_code at ../../gcc/caller-save.c:141


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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The ICE is around
140       ok = (cached_reg_save_code[reg][mode] != -1
141             && cached_reg_restore_code[reg][mode] != -1);
   0x0000000010e84a24 <reg_save_code(int, machine_mode)+436>:   stw    
r10,1792(r6)
   0x0000000010e84a28 <reg_save_code(int, machine_mode)+440>:   stw    
r10,-21428(r8)
   0x0000000010e84a2c <reg_save_code(int, machine_mode)+444>:   b      
0x10e849e4 <reg_save_code(int, machine_mode)+372>
   0x0000000010e84a30 <reg_save_code(int, machine_mode)+448>:   addis   r9,r9,1
=> 0x0000000010e84a34 <reg_save_code(int, machine_mode)+452>:   lwz    
r9,-21428(r9)
   0x0000000010e84a38 <reg_save_code(int, machine_mode)+456>:   cmpwi   r9,-1
   0x0000000010e84a3c <reg_save_code(int, machine_mode)+460>:   beq-   
0x10e849c8 <reg_save_code(int, machine_mode)+344>
   0x0000000010e84a40 <reg_save_code(int, machine_mode)+464>:   addis   r3,r2,1
   0x0000000010e84a44 <reg_save_code(int, machine_mode)+468>:   ld     
r3,-29144(r3)
   0x0000000010e84a48 <reg_save_code(int, machine_mode)+472>:   bl     
0x109149d0 <extract_insn(rtx_insn*)>
   0x0000000010e84a4c <reg_save_code(int, machine_mode)+476>:   nop
   0x0000000010e84a50 <reg_save_code(int, machine_mode)+480>:   addis   r3,r2,1
End of assembler dump.
(gdb) p/x $r9
$2 = 0x1dd90
(gdb) p this_target_reload
$3 = (target_reload *) 0x117060d8 <default_target_reload>
(gdb) p &this_target_reload
$4 = (target_reload **) 0x11586948 <this_target_reload>

The addis r9,r9,1;lwz r9,-21428(r9) is in *.final:
(insn:TI 366 165 169 (set (reg:DI 9 9)
        (unspec:DI [
                (zero_extend:DI (mem:SI (plus:DI (plus:DI (reg/f:DI 9 9
[orig:199 _98 ] [199])
                                (const_int 65536 [0x10000]))
                            (const_int -21428 [0xffffffffffffac4c])) [79
MEM[(struct target_reload *)_98 + 44108B]+0 S4 A32]))
            ] UNSPEC_FUSION_GPR)) ../../gcc/caller-save.c:141 858
{fusion_gpr_load_di}
     (nil))
(insn 169 366 170 (set (reg:CC 68 0 [270])
        (compare:CC (reg:SI 9 9 [orig:268 MEM[(struct target_reload *)_98 +
44108B] ] [268])
            (const_int -1 [0xffffffffffffffff]))) ../../gcc/caller-save.c:141
720 {*cmpsi_signed}
     (expr_list:REG_DEAD (reg:SI 9 9 [orig:268 MEM[(struct target_reload *)_98
+ 44108B] ] [268])
        (nil)))
but that assumes that r9 contains at that point probably this_target_reload
value, i.e. should be 0x117060d8.
In the code that branches to this spot we have right after reload:
(insn 146 141 144 14 (set (reg/f:DI 9 9 [orig:258 this_target_reload ] [258])
        (mem/f/c:DI (reg/f:DI 28 28 [299]) [80 this_target_reload+0 S8 A64]))
550 {*movdi_internal64}
     (expr_list:REG_EQUIV (mem/f/c:DI (reg/f:DI 28 28 [299]) [80
this_target_reload+0 S8 A64])
        (expr_list:REG_EQUAL (mem/f/c:DI (symbol_ref:DI ("this_target_reload")
[flags 0xc0]  <var_decl 0x7f3236bff990 this_target_reload>) [80 this
            (nil))))
...
(insn 147 144 148 14 (set (reg/f:DI 9 9 [orig:199 _98 ] [199])
        (plus:DI (reg/f:DI 9 9 [orig:258 this_target_reload ] [258])
            (reg:DI 30 30 [orig:196 _89 ] [196]))) 81 {*adddi3}
     (nil))
(insn 148 147 150 14 (set (reg:SI 10 10 [orig:259 MEM[(struct target_reload
*)_98 + 1792B] ] [259])
        (mem:SI (plus:DI (reg/f:DI 9 9 [orig:199 _98 ] [199])
                (const_int 1792 [0x700])) [79 MEM[(struct target_reload *)_98 +
1792B]+0 S4 A32])) ../../gcc/caller-save.c:141 438 {*movsi_internal
     (expr_list:REG_EQUIV (mem:SI (plus:DI (reg/f:DI 9 9 [orig:199 _98 ] [199])
                (const_int 1792 [0x700])) [79 MEM[(struct target_reload *)_98 +
1792B]+0 S4 A32])
        (nil)))
(insn 150 148 151 14 (set (reg:CC 75 7 [261])
        (compare:CC (reg:SI 10 10 [orig:259 MEM[(struct target_reload *)_98 +
1792B] ] [259])
            (const_int -1 [0xffffffffffffffff]))) ../../gcc/caller-save.c:141
720 {*cmpsi_signed}
     (nil))
(jump_insn 151 150 171 14 (set (pc)
        (if_then_else (ne (reg:CC 75 7 [261])
                (const_int 0 [0]))
            (label_ref 164)
            (pc))) ../../gcc/caller-save.c:141 756 {*rs6000.md:11629}
     (int_list:REG_BR_PROB 3226 (nil))
 -> 164)
but in *.final that doesn't set reg 9 anymore:
(insn 146 138 139 (set (reg/f:DI 8 8 [orig:258 this_target_reload ] [258])
        (mem/f/c:DI (reg/f:DI 28 28 [299]) [80 this_target_reload+0 S8 A64]))
550 {*movdi_internal64}
     (expr_list:REG_EQUIV (mem/f/c:DI (reg/f:DI 28 28 [299]) [80
this_target_reload+0 S8 A64])
        (expr_list:REG_EQUAL (mem/f/c:DI (symbol_ref:DI ("this_target_reload")
[flags 0xc0]  <var_decl 0x7f3236bff990 this_target_reload>) [80 this
            (nil))))
...
(insn 147 141 144 (set (reg/f:DI 3 3 [orig:199 _98 ] [199])
        (plus:DI (reg/f:DI 8 8 [orig:258 this_target_reload ] [258])
            (reg:DI 30 30 [orig:196 _89 ] [196]))) 81 {*adddi3}
     (expr_list:REG_DEAD (reg/f:DI 8 8 [orig:258 this_target_reload ] [258])
        (nil)))
(insn:TI 144 147 148 (set (mem:SI (plus:DI (reg:DI 10 10 [254])
                (const_int 12 [0xc])) [4
this_target_reload.31_26->x_cached_reg_restore_code S4 A32])
        (reg:SI 6 6 [orig:301 restinsn.38_27->D.43974.u.fld[5].rt_int ] [301]))
../../gcc/caller-save.c:134 438 {*movsi_internal1}
     (expr_list:REG_DEAD (reg:DI 10 10 [254])
        (expr_list:REG_DEAD (reg:SI 6 6 [orig:301
restinsn.38_27->D.43974.u.fld[5].rt_int ] [301])
            (nil))))
(insn 148 144 150 (set (reg:DI 7 7)
        (zero_extend:DI (mem:SI (plus:DI (reg/f:DI 3 3 [orig:199 _98 ] [199])
                    (const_int 1792 [0x700])) [79 MEM[(struct target_reload
*)_98 + 1792B]+0 S4 A32]))) ../../gcc/caller-save.c:141 26 {zero_extend
     (expr_list:REG_DEAD (reg/f:DI 3 3 [orig:199 _98 ] [199])
        (expr_list:REG_EQUIV (mem:SI (plus:DI (reg/f:DI 9 9 [orig:199 _98 ]
[199])
                    (const_int 1792 [0x700])) [79 MEM[(struct target_reload
*)_98 + 1792B]+0 S4 A32])
            (nil))))
(insn 150 148 151 (set (reg:CC 75 7 [261])
        (compare:CC (reg:SI 7 7 [orig:259 MEM[(struct target_reload *)_98 +
1792B] ] [259])
            (const_int -1 [0xffffffffffffffff]))) ../../gcc/caller-save.c:141
720 {*cmpsi_signed}
     (expr_list:REG_DEAD (reg:SI 7 7 [orig:259 MEM[(struct target_reload *)_98
+ 1792B] ] [259])
        (nil)))
(jump_insn 151 150 171 (set (pc)
        (if_then_else (ne (reg:CC 75 7 [261])
                (const_int 0 [0]))
            (label_ref 164)
            (pc))) ../../gcc/caller-save.c:141 756 {*rs6000.md:11629}
     (expr_list:REG_DEAD (reg:CC 75 7 [261])
        (int_list:REG_BR_PROB 3226 (nil)))
 -> 164)

I think it goes wrong during *.rnreg pass, still in *.ce3 I see code branching
to label_ref 164 (aka .L136) still setting r9 and code after that label using
that register,
but in *.rnreg dump the code branching there is setting r8/r3 instead, while
code after the label still using r9.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]