This patch makes emit_inc_dec_insn_before use add3_insn / gen_move_insn so that the appropriate expanders are used to create the new instructions, and for dse it use the available register liveness information to check that no live fixed hard register, like a flags register, is clobbered in the process. For postreload, there is no such information available, so we give up when we see a clobber / set that might be problematic. regtested for epiphany-elf with modified rtx_cost, where it fixes three ICE-on-valid-code: FAIL: gcc.c-torture/execute/builtins/memcpy-chk.c compilation, -O1 (internal compiler error) FAIL: gcc.c-torture/execute/builtins/memmove-chk.c compilation, -O1 (internal compiler error) FAIL: gcc.c-torture/execute/memcpy-bi.c compilation, -O1 (internal compiler error) Bootstrapped and regression tested on i686-pc-linux-gnu .