This is the first patch for the loop guard. We introduced getLoopGuardBranch(), isLoopGuardBranch(), and isGuarded(). In this patch, any conditional branch instructions which can decide if the loop is executed are consider as a loop guard. There can be multiple loop guards for a loop.
Prior discussions leading upto the decision to introduce the loop guard API: