https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61576
--- Comment #4 from Yuri Rumyantsev <ysrumyan at gmail dot com> --- There is an issue with phi-node and reduction stmt - after r211302 new hammock was inserted between reduction stmt and bb containing phi: <bb 6>: d.6_12 = d_lsm.14_17 + 1; if (c.8_13 != 0) goto <bb 7>; else goto <bb 8>; <bb 7>: <bb 8>: # iftmp.7_15 = PHI <1(7), _19(6)> <bb 9>: # d_lsm.14_16 = PHI <d_lsm.14_17(5), d.6_12(8)> but algorithm for converting conditional scalar reduction assumes that basic block containing reduction is one of predecessors of phi-block. I added check on it and test is passed. BTW I wonder why such code motion has been done - in fact, redundant computations were introduced in loop, before this fix all computations related to hammock were hoisted out off loop: <bb 4>: d_lsm.14_25 = d; c.8_13 = c; f.9_14 = f; _18 = f.9_14 != 0; _19 = (int) _18; iftmp.7_15 = c.8_13 != 0 ? 1 : _19; e_lsm.15_26 = e; <bb 5>: # d_lsm.14_17 = PHI <d_lsm.14_25(4), d_lsm.14_16(9)> # e_lsm.15_1 = PHI <e_lsm.15_26(4), e_lsm.15_24(9)> b.4_10 ={v} b; if (b.4_10 != 0) goto <bb 6>; else goto <bb 7>; <bb 6>: d.6_12 = d_lsm.14_17 + 1; <bb 7>: # d_lsm.14_16 = PHI <d_lsm.14_17(5), d.6_12(6)> # e_lsm.15_24 = PHI <e_lsm.15_1(5), iftmp.7_15(6)> I will send for review patch after required testing completion.