Fix a bug in LinearFunctionTestReplace that created invalid loop exit checks.