https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103750
--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> --- (In reply to Hongtao.liu from comment #2) > Failed here > > /* Allow propagations into a loop only for reg-to-reg copies, since > replacing one register by another shouldn't increase the cost. */ > struct loop *def_loop = def_insn->bb ()->cfg_bb ()->loop_father; > struct loop *use_loop = use->bb ()->cfg_bb ()->loop_father; > if ((reg_prop_only || def_loop != use_loop) > && (!reg_single_def_p (dest) || !reg_single_def_p (src))) > return false; > > But def_loop is inner loop of use_loop, it should be ok to propagate from > inner loop to outer loop. Guess def_loop != use_loop used here with assumption that those "invariant" should be sinked into same loop.