https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104515
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #1) > Confirmed. The issue is that store motion of v_7(D)->end cannot be > performed on > > <bb 3> [local count: 955630225]: > # i_13 = PHI <i_10(6), 0(5)> > _1 = v_7(D)->end; > _2 = _1 + 18446744073709551612; > v_7(D)->end = _2; > MEM[(T *)_1 + -4B] ={v} {CLOBBER}; // <- inserted by -flifetime-dse > i_10 = i_13 + 1; > if (n_6(D) > i_10) > goto <bb 6>; [89.00%] > else > goto <bb 4>; [11.00%] > > <bb 6> [local count: 850510901]: > goto <bb 3>; [100.00%] It's possible to perform store-motion of the above as the following, preserving the CLOBBER in the loop but necessarily re-issueing the last iteration CLOBBER on the exit edge. I _think_ that's fine to do. The oacc-kernels pipeline does LIM quite early before IPA. For the later LIM passes we might as well go with eliminating the non-decl CLOBBERs earlier - but the issue also exists for decl CLOBBERs of course. Note duplicating "lifetime" CLOBBERs might prove bad (we only have EOL clobbers right now). <bb 3> [local count: 955630225]: # i_13 = PHI <i_10(6), 0(5)> # v__end_lsm.3_4 = PHI <v__end_lsm.3_12(6), v__end_lsm.3_3(5)> _1 = v__end_lsm.3_4; _2 = _1 + 18446744073709551612; v__end_lsm.3_12 = _2; MEM[(int *)_1 + -4B] ={v} {CLOBBER}; i_10 = i_13 + 1; if (n_6(D) > i_10) goto <bb 6>; [89.00%] else goto <bb 7>; [11.00%] <bb 6> [local count: 850510901]: goto <bb 3>; [100.00%] <bb 7> [local count: 105119324]: # _17 = PHI <_1(3)> # v__end_lsm.3_19 = PHI <v__end_lsm.3_12(3)> v_7(D)->end = v__end_lsm.3_19; MEM[(int *)_17 + -4B] ={v} {CLOBBER}; <bb 4> [local count: 118111600]: return;