For the init loop, The compiler is unable to prove that
"<= lenS1" is essentially same as "< len(x)". So we mention it
explicitly.
Made a dummy bounds check to prevent further checks for x[lenS1]
down below. And this also takes care of x[j-1] since j is <= lenS1.
This effectively reduces the number of bounds checks from 7 to just 1,
which is the dummy call to x[lenS1]. The compiler, as of 1.12,
is unable to determine that lenS1 is indeed a positive number. So
lenS1+1 will be positive, and hence x[lenS1] should be within bounds
of x. As a result, this is unavoidable.
For the init loop, The compiler is unable to prove that "<= lenS1" is essentially same as "< len(x)". So we mention it explicitly.
Made a dummy bounds check to prevent further checks for x[lenS1] down below. And this also takes care of x[j-1] since j is <= lenS1.
This effectively reduces the number of bounds checks from 7 to just 1, which is the dummy call to x[lenS1]. The compiler, as of 1.12, is unable to determine that lenS1 is indeed a positive number. So lenS1+1 will be positive, and hence x[lenS1] should be within bounds of x. As a result, this is unavoidable.