body would be the after-iter value of the first body) if it's over
an associative and commutative operation. We wouldn't
be able to handle unknown cycles. */
+ bool inner_vdef = false;
for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi))
{
affine_iv iv;
tree op = gimple_phi_result (psi.phi ());
if (virtual_operand_p (op))
- continue;
+ {
+ inner_vdef = true;
+ continue;
+ }
if (!simple_iv (loop, loop, op, &iv, true))
return false;
/* The inductions must be regular, loop invariant step and initial
copy, _not_ the next value of the second body. */
}
+ /* When there's no inner loop virtual PHI IV we cannot handle the update
+ required to the inner loop if that doesn't already have one. See
+ PR117113. */
+ if (!inner_vdef && get_virtual_phi (outer->header))
+ return false;
+
return true;
}