https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123786
--- Comment #8 from Artemiy Volkov <artemiyv at gcc dot gnu.org> ---
Moving the second insn across basic blocks looks really wrong. The quickest
workaround is to just explicitly forbid that:
diff --git a/gcc/dep-fusion.cc b/gcc/dep-fusion.cc
index c849da101f9..e2f8363a2b7 100644
--- a/gcc/dep-fusion.cc
+++ b/gcc/dep-fusion.cc
@@ -99,6 +99,7 @@ pass_dep_fusion::execute (function *fn)
rtl_ssa::use_info *use_insn = def->single_nondebug_insn_use ();
if (!use_insn
+ || use_insn->bb() != insn->bb()
|| !use_insn->insn ()->can_be_optimized ()
|| !targetm.sched.macro_fusion_pair_p (insn->rtl (),
use_insn->insn ()->rtl ()))
Cross-BB movements aren't very interesting in the context of this pass anyway,
I think.