[1.11>master] [MERGE #6009 @MikeHolman] disable switch opt when break…
…ing out of loops
Merge pull request #6009 from MikeHolman:switchbug1_11
Cherry-picking to release/1.11 from master.
Switch opt gets confused when we need to branch to labels outside the loop, so just disabling it in this case.