https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107254
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- So I think the issue is that we have a live operation: <bb 3> [local count: 955630225]: # jc_42 = PHI <jc_36(7), 1(6)> _2 = (integer(kind=8)) jc_42; _3 = _2 * stride.1_23; _4 = _3 + offset.2_24; _5 = _4 + 1; _6 = (*h_28(D))[_5]; _7 = _6 * 9.0000000000000002220446049250313080847263336181640625e-1; _8 = _4 + 2; _9 = (*h_28(D))[_8]; temp_29 = _7 + _9; _10 = _9 * 9.0000000000000002220446049250313080847263336181640625e-1; _11 = _10 - _6; (*h_28(D))[_8] = _11; (*h_28(D))[_5] = temp_29; _12 = (*t_32(D))[_5]; _13 = _12 * 9.0000000000000002220446049250313080847263336181640625e-1; _14 = (*t_32(D))[_8]; _15 = _13 + _14; _16 = _14 * 9.0000000000000002220446049250313080847263336181640625e-1; _17 = _16 - _12; (*t_32(D))[_8] = _17; (*t_32(D))[_5] = _15; jc_36 = jc_42 + 1; if (_1 < jc_36) goto <bb 4>; [11.00%] else goto <bb 7>; [89.00%] <bb 7> [local count: 850510901]: goto <bb 3>; [100.00%] <bb 4> [local count: 105119324]: # _72 = PHI <_15(3)> # _71 = PHI <_17(3)> ^^^ that we fail to vectorize which keeps the _12 and _14 loads live but those are from the wrong iteration. The out-of loop stores are caused by invariant motion of 'temp2' (it's memory because it's passed to dlartg) and which we apperantly cannot disambiguate against the stores to t so we re-materialize them on the loop exit. The vectorizer sees t.f90:27:9: note: init: stmt relevant? _15 = _13 + _14; t.f90:27:9: note: vec_stmt_relevant_p: used out of loop. t.f90:27:9: note: vect_is_simple_use: operand _12 * 9.0000000000000002220446049250313080847263336181640625e-1, type of def: internal t.f90:27:9: note: vec_stmt_relevant_p: stmt live but not relevant. t.f90:27:9: note: mark relevant 1, live 1: _15 = _13 + _14; and later t.f90:27:9: note: op: VEC_PERM_EXPR t.f90:27:9: note: stmt 0 _15 = _13 + _14; t.f90:27:9: note: stmt 1 _17 = _16 - _12; t.f90:27:9: note: lane permutation { 0[0] 1[1] } t.f90:27:9: note: children 0x3358e90 0x3358f18 t.f90:27:9: note: node 0x3358e90 (max_nunits=1, refcnt=1) vector(4) real(kind=8) t.f90:27:9: note: op template: _15 = _13 + _14; t.f90:27:9: note: { } t.f90:27:9: note: children 0x3358c70 0x3358e08 ... t.f90:27:9: note: node 0x3358f18 (max_nunits=1, refcnt=1) vector(4) real(kind=8) t.f90:27:9: note: op template: _17 = _16 - _12; t.f90:27:9: note: { } t.f90:27:9: note: children 0x3358c70 0x3358e08 investigating further.