https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107057
--- Comment #5 from Hongtao.liu <crazylht at gmail dot com> --- I'm testing modified gcc/lra-constraints.cc @@ -4382,7 +4382,14 @@ curr_insn_transform (bool check_only_p) (op, (enum reg_class) goal_alt[i]) == NO_REGS) || no_input_reloads_p)) { - rtx tem = force_const_mem (mode, op); + rtx tem; + + /* PR 107057, for same constant pool, don't bother + force_const_mem again, just reuse the matched op. */ + if (goal_alt_matches[i] >= 0) + tem = *curr_id->operand_loc[goal_alt_matches[i]]; + else + tem = force_const_mem (mode, op); change_p = true; if (subreg != NULL_RTX)