There are situations buitlin_expect is used on a set of conditions (&&, ||) where there is only one expect builtin call inserted. There is also situations where the result of builtin_expect is not fed into any branches (e.g, a ternary expression). In the above cases, the lowering phase fails to annotate the all related branches.
This patch enhances the lowering phase by doing 'backward' analysis with Phidefs. For examples, see the test cases.
nit: wording might be clearer as: