Note! http://reviews.llvm.org/D16315 is depend on this patch.
Bug case (When enable both SCO and ShrinkWrapping):
# BB#0: # %entry cmpldi 3, 0 beq- 0, .LBB0_2 # BB#1: # %exit lwz 4, 0(3) #TC_RETURNd8 LVComputationKind 0 .LBB0_2: # %cond.false mflr 0 std 0, 16(1) stdu 1, -96(1) .Ltmp0: .cfi_def_cfa_offset 96 .Ltmp1: .cfi_offset lr, 16 bl __assert_fail nop
The branch instruction for tail call return is not generated, because the shrink-wrapping pass choosing a new Restore Point: %cond.false, so %exit block is not sent to emitEpilogue, that's why the branch is not generated.
We handle this case in processFunctionBeforeFrameFinalized.
This comment isn't accurate since you've refactored the code from emitEpilogue into this method.
You could probably remove it altogether, but if you want to keep it I could change it to "Originally from emitEpilogue".