https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126887
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #4)
> gcc.dg/uninit-1.c (bogus warning at any -O)
>
> is not fixed. Here DOM seems to (late) peel the first outer loop iteration,
> another peeling shape we do not allow.
>
> for (p = el; p; p = p->next)
> {
> for (q = el; q != p; q = q->next)
> ...
> r = p;
> }
>
> the inner loop guard q != p is trivially false, so r is initialized always.
> Also uninit-1.c runs with -O1 where ranger based threading seems not to run
> at all.
>
> IIRC I tried to enable such theadings but had to revert
> (r16-303-g1a13684dfc7286)
So not exactly. DOM threads 10 -> 8 , 8 -> 7, which ends up rotating
the loop as it does not fully peel up to the latch. It's more difficult
to exactly identify not harmful threadings like this. Peeling the complete
first outer iteration would be more logical IMO, but that's less of just
threading given the outer loop exit condition isn't statically known.
<bb 10> [local count: 12634987]:
goto <bb 8>; [100.00%]
<bb 8> [local count: 114863530]: // loop header
# p_21 = PHI <p_16(11), el_10(D)(10)>
# r_23 = PHI <p_4(11), r_11(D)(10)>
if (el_10(D) != p_21)
goto <bb 3>; [94.50%]
else
goto <bb 7>; [5.50%]
<bb 7> [local count: 114863531]:
# p_4 = PHI <r_23(5), p_21(8), p_21(6)>
p_16 = p_4->next;
if (p_16 != 0B)
goto <bb 11>; [89.00%]
else
goto <bb 9>; [11.00%]
<bb 11> [local count: 102228543]:
-> bb 8
<bb 9> [local count: 14196616]:
return;