https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64160
Ulrich Weigand <uweigand at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |uweigand at gcc dot gnu.org --- Comment #1 from Ulrich Weigand <uweigand at gcc dot gnu.org> --- This is not a reload problem, it's a bug in the addsi3 splitter where it doesn't account for overlapping source and destination. We have initially: (insn 11 10 12 2 (set (reg:SI 13 R13) (plus:SI (reg:SI 12 R12) (mem:SI (reg/v/f:HI 28 [ ap ]) [2 ap_4(D)->duration+0 S4 A16]))) bug.i:10 20 {addsi3} (expr_list:REG_DEAD (reg:HI 12 R12) (nil))) Note where the destination (reg:SI 13) partially overlaps the source (reg:SI 12). After split 1 we have: (insn 22 10 23 2 (parallel [ (set (reg:HI 13 R13) (plus:HI (reg:HI 12 R12) (mem:HI (reg/v/f:HI 28 [ ap ]) [2 ap_4(D)->duration+0 S2 A16]))) (set (reg:BI 2 R2) (truncate:BI (lshiftrt:SI (plus:SI (zero_extend:SI (reg:HI 12 R12)) (zero_extend:SI (mem:HI (reg/v/f:HI 28 [ ap ]) [2 ap_4(D)->duration+0 S2 A16]))) (const_int 16 [0x10])))) ]) bug.i:10 -1 (nil)) (insn 23 22 12 2 (set (reg:HI 14 R14 [+2 ]) (plus:HI (plus:HI (reg:HI 13 R13 [+2 ]) (mem:HI (plus:HI (reg/v/f:HI 28 [ ap ]) (const_int 2 [0x2])) [2 ap_4(D)->duration+2 S2 A16])) (zero_extend:HI (reg:BI 2 R2)))) bug.i:10 -1 (nil)) Note how the first insn of the pair now clobbers the part of the source that is still needed for the second half.