https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95210
Bug ID: 95210 Summary: internal compiler error: in prepare_copy_insn, at gcse.c:1988 Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: zhongyunde at tom dot com Target Milestone: --- rtx_insn * prepare_copy_insn (rtx reg, rtx exp) { ... else { rtx_insn *insn = emit_insn (gen_rtx_SET (reg, exp)); if (insn_invalid_p (insn, false)) gcc_unreachable (); // here is the ICE ... } pat = get_insns (); end_sequence (); return pat; } As the function can_assign_to_reg_without_clobbers_p, we try to check an temporary insn with regno 'FIRST_PSEUDO_REGISTER * 2'. So in some corner case, such as a pattern with inout operand, the regno 'FIRST_PSEUDO_REGISTER * 2' is just equal to the the regno in the REG_EQUAL (FIRST_PSEUDO_REGISTER = 117), then the temporary insn is valid, but it come fail when alloc another regno for it, here is this issue. (set (reg/v:V8HF16 236 ) (unspec: V8HF18 [ (reg: V8HF18 150) (reg: V8HF18 236)] UNSPEC_MOVTVFM)) (expr_list:REG_EQUAL (unspec: V8HF18 [ (reg: V8HF18 150) (reg: V8HF18 234)] UNSPEC_MOVTVFM )) bool can_assign_to_reg_without_clobbers_p (rtx x, machine_mode mode) { .... /* Otherwise, check if we can make a valid insn from it. First initialize our test insn if we haven't already. */ if (test_insn == 0) { test_insn = make_insn_raw (gen_rtx_SET (gen_rtx_REG (word_mode, FIRST_PSEUDO_REGISTER * 2), const0_rtx)); SET_NEXT_INSN (test_insn) = SET_PREV_INSN (test_insn) = 0; INSN_LOCATION (test_insn) = UNKNOWN_LOCATION; } /* Now make an insn like the one we would make when GCSE'ing and see if valid. */ PUT_MODE (SET_DEST (PATTERN (test_insn)), mode); SET_SRC (PATTERN (test_insn)) = x; icode = recog (PATTERN (test_insn), test_insn, &num_clobbers);