Hi Richard, 在 2024/6/17 17:04, Richard Sandiford 写道: > I don't think we should keep the single_set condition after this change. > insn_cost can handle all instructions.
Just tested with removing single_set condition. It causes some regressions. If the new_rtl is a debug insn, it still can do the replacement as it can be recog and it's not a single_set rtl. After removing single_set condition, the "ok" (recog) will be reset to false in the "if" block as the cost of debug insn is unknown. So the replacement won't be done. bool ok = recog (attempt, use_change); if (ok && !prop.changed_mem_p () && !use_insn->is_asm ()) { bool strict_p = !prop.likely_profitable_p (); if (!change_is_worthwhile (use_change, strict_p)) { if (dump_file) fprintf (dump_file, "change not profitable"); ok = false; } } if (!ok) { /* The pattern didn't match, but if all uses of SRC folded to constants, we can add a REG_EQUAL note for the result, if there isn't one already. */ if (!prop.folded_to_constants_p ()) Looking forwarding to your advice. Thanks Gui Haochen