This change extends the solution accepted in D127766 to strncmp: it simplifies strncmp(A, B, N) calls with constant A and B and variable N to the equivalent of
N <= Pos ? 0 : (A < B ? -1 : B < A ? +1 : 0)
where Pos is the offset of either the first mismatch between A and B or the terminating null character if both A and B are equal strings.
I couldn't find a good way to preserve the form of the loop in optimizeMemCmpVarSize so this change reverts it to the form originally proposed in D127766.
Not really sure why the change in code structure is needed. As far as I can tell, the only thing that's actually changing here is that a
condition gets added to the top of the loop body? Or am I misunderstanding something here?