If LAA expands a bound that is loop invariant, but not hoisted out
of the loop body, it used to use that value anyway, causing a
non-domination error, because the memcheck block is of course not
dominated by the scalar loop body. Detect this situation and expand
the SCEV expression instead.
Fixes PR31251
Please note, I don't know this part of the code base at all, so while
I patched up the symptoms, there may be something more fundamental at
play here that I'm oblivious to.