We use the same similarity scheme we used for branch instructions for phi nodes, and allow them to be outlined. There is not a lot of special handling needed for these phi nodes when outlining, as they simply act as outputs. The code extractor does not currently allow for non entry blocks within the extracted region to have predecessors, so there are not conflicts to handle with respect to predecessors no longer contained in the function.
comment on the loop?
add in-code comments to the loop?
since Term is only used for computing BI, it might as well be folded in here.
"original beginning go the branch instruction" doesn't make a lot of sense?
Is there a more succinct way to compute this?