Fixes to loop invariance detection.
Add test that revealed loop invariance deficiency.
Another fix to loop invariance.
Fix loopResultContext for ExplicitMemory.