https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68624
--- Comment #5 from ktkachov at gcc dot gnu.org --- Thanks, I've come to the same conclusion. The code in noce_cmove_arith that checks for overlapping writes among the basic blocks has a bug. In the code: if (emit_a || modified_in_a) { modified_in_b = emit_b != NULL_RTX && modified_in_p (orig_a, emit_b); if (tmp_b && else_bb) ... changing the second if to: if (tmp_a && else_bb) fixes the testcase. But the whole logic there is becoming somewhat convoluted. I'll see if I can make the control flow there clearer