If the branch is hoisted to the loop header, and we know that it was originally
reachable, then no freeze instruction is needed since we are not introducing
a new branch in the dynamic control-flow.
For example:
while (D) {
I1
I2
if (C) { A }
else { B }
}If we know that I1 and I2 always transfer execution to the successor, then we
know that branch on C is reachable if D is true at least once.
Therefore, transforming the code above to the following is correct:
if (D) {
if (C) {
do { I1 I2 A } while (D)
} else {
do { I1 I2 B } while (D)
}
}
break;
No need to keep going if we're just going to break the outer loop.