https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65151
--- Comment #6 from Oleg Endo <olegendo at gcc dot gnu.org> --- (In reply to Oleg Endo from comment #5) > The problem is the following insn: > > (insn 45 11 12 2 (set (reg:HI 168 [ x ]) > (subreg/s/u:HI (reg:SI 147 t) 0)) cchMsw9Z.out:9 -1 > (expr_list:REG_DEAD (reg:SI 147 t) > (nil))) > > which is not in sh.md. > The insn is created by the asmcons pass. More precisely, it's 'emit_move_insn' in gcc/function.c in function match_asm_constraints_1 at line 7152. BTW, the test case from attachment 34825 also fails at -O1, -O2 and -Os. On current trunk (GCC 5), the problem doesn't happen due to the treg_set_expr stuff that has been recently added, it seems. After combine, the insns are: (insn 11 8 12 2 (parallel [ (set (reg/v:SI 163 [ x ]) (eq:SI (reg:SI 6 r6 [ bits_per_component ]) (const_int 10 [0xa]))) (clobber (reg:SI 147 t)) ]) 410 {any_treg_expr_to_reg} (expr_list:REG_UNUSED (reg:SI 147 t) (expr_list:REG_DEAD (reg:SI 6 r6 [ bits_per_component ]) (nil)))) (insn 12 11 13 2 (set (reg:HI 170 [ x ]) (asm_operands:HI ("swap.b %0,%0") ("=r") 0 [ (subreg/s/v:HI (reg/v:SI 163 [ x ]) 0) ] [ (asm_input:HI ("0") cchMsw9Z.out:8) ] [] cchMsw9Z.out:8)) cchMsw9Z.out:8 -1 (expr_list:REG_DEAD (reg/v:SI 163 [ x ]) (nil))) Which is then converted by the treg_set_expr splitter code during the split1 pass into: (insn 52 8 53 2 (set (reg:SI 147 t) (eq:SI (reg:SI 6 r6 [ bits_per_component ]) (const_int 10 [0xa]))) -1 (nil)) (insn 53 52 12 2 (set (reg/v:SI 163 [ x ]) (reg:SI 147 t)) -1 (expr_list:REG_UNUSED (reg:SI 147 t) (nil))) (insn 12 53 13 2 (set (reg:HI 170 [ x ]) (asm_operands:HI ("swap.b %0,%0") ("=r") 0 [ (subreg/s/v:HI (reg/v:SI 163 [ x ]) 0) ] [ (asm_input:HI ("0") cchMsw9Z.out:8) ] [] cchMsw9Z.out:8)) cchMsw9Z.out:8 -1 (expr_list:REG_DEAD (reg/v:SI 163 [ x ]) (nil))) In asmcons, emit_move_insn then adds the following insn: (insn 58 53 12 2 (set (reg:HI 170 [ x ]) (subreg/s/v:HI (reg/v:SI 163 [ x ]) 0)) cchMsw9Z.out:8 -1 (nil)) from there on everything works out.