https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78016
--- Comment #4 from Jiong Wang <jiwang at gcc dot gnu.org> --- (In reply to Eric Botcazou from comment #3) > > I am wondering whether it's OK to use copy_insn_1 here? that is to replace > > the whole for loop into something simply as "REG_NOTES (new_insn) = > > copy_insn_1 (REG_NOTES (old_insn);" as I think copy_insn_1 will do > > recursive copy. This is what's used in old reload1.c. > > Yet another way of copying notes... I didn't know about it but, yes, it > looks well-behaved, albeit a bit heavier than the others. > > Ideally we would have a single routine along the other routines in rtlanal.c > to deal with note copying, with a few boolean parameters to drop some of > them. > > > So copy_insn_1 is safe? > > I'd write something more specialized in rtlanal.c instead. Thanks, Eric. I am thinking to make those list insertion function in lists.c bi-directional, then make existed allocate_EXPR_LIST/INST_LIST/INT_LIST call new bi-directional functions. Will post the patch once regression OK.