This is the first patch for the loop guard. We introduced getLoopGuardBranch() and isGuarded(). In this patch, any conditional branch instructions which can decide if the loop is executed are consider as a loop guard.
For rotated loops, the guard branch determines if the loop executes at least one iteration.
That is, a rotated loop with a guard branch will execute 0 or more times, depending on the evaluation of the guard.
On the other hand, a rotated loop with no guard branch will execute 1 or more times.
This currently only works on simplified loop, as it requires a preheader and a latch to identify the guard.
It will work on loops of the form:
/// br cond1, Preheader, ExitSucc <== GuardBranch
/// br Header
/// br Latch
/// br cond2, Header, ExitBlock
/// br ExitSucc
Prior discussions leading upto the decision to introduce the loop guard API: