https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80025
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So the reason we get so weird locations is we have: (debug_insn 20 19 21 3 (var_location:DI D#6 (xor:DI (xor:DI (reg:DI 0 ax [orig:95 l3.6_9 ] [95]) (reg:DI 1 dx [103])) (const_int 1 [0x1]))) "pr80025.c":22 -1 (nil)) $110 = void (gdb) p debug_rtx (insn->u.fld[1].rt_rtx) (insn:TI 21 20 22 3 (parallel [ (set (reg:DI 0 ax [105]) (xor:DI (reg:DI 0 ax [orig:95 l3.6_9 ] [95]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) "pr80025.c":22 418 {*xordi_1} (expr_list:REG_UNUSED (reg:CC 17 flags) (nil))) and register dx contains (const_int 1). ax before insn 21 change is value 19:19, value 21:8705 is whatever we've created for the whole debug_insn 20 expression, with (xor:DI (xor:DI (value/u:DI 19:19 @0x2920a70/0x2844900) (value/u:DI 13:4258 @0x29209e0/0x28447e0)) (const_int 1 [0x1])) loc, where value 13:4258 is that of dx with const_int 1 in it. The new value of ax after insn 21 is 22:4362, which has (xor:DI (value/u:DI 19:19 @0x2920a70/0x2844900) (const_int 1 [0x1])) as its location. Then as XOR is reversible, we try to create the reverse mapping for that and for that attempt to permanently equate 19:19 to (xor:DI (value:DI 22:4362 @0x2920ab8/0x2844990) (const_int 1 [0x1])) But during cselib lookup of that expression we find that value 21:8705 has the same value and thus equate 19:19 to the loc from 21:8705, which is the self-reference.