liberty/lib/Utilities/InlineFunctionWithVmap.cpp
/// HandleInlinedInvoke - If we inlined an invoke site, we need to convert calls
/// in the body of the inlined function into invokes.
///
/// II is the invoke instruction being inlined.  FirstNewBlock is the first
/// block of the inlined code (the last block is the end of the function),
/// and InlineCodeInfo is information about the code that got inlined.
If we inlined an invoke site, we need to convert calls
in the body of the inlined function into invokes.

II is the invoke instruction being inlined.  FirstNewBlock is the first
block of the inlined code (the last block is the end of the function),
and InlineCodeInfo is information about the code that got inlined.
If we inlined an invoke site we need to convert calls in the body of the inlined function into invokes . II is the invoke instruction being inlined . FirstNewBlock is the first block of the inlined code ( the last block is the end of the function ) and InlineCodeInfo is information about the code that got inlined .
static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
                                ClonedCodeInfo &InlinedCodeInfo,
                                CallsPromotedToInvoke &call2invoke) {
  BasicBlock *InvokeDest = II->getUnwindDest();
  Function *Caller = FirstNewBlock->getParent();
  if (!InlinedCodeInfo.ContainsCalls) {
    InvokeDest->removePredecessor(II->getParent());
    return;
  }
  InvokeInliningInfo Invoke(II);
	Function::iterator BB (FirstNewBlock);
  for (Function::iterator E = Caller->end(); BB != E; ++BB){
    if (InlinedCodeInfo.ContainsCalls)
      if (HandleCallsInBlockInlinedThroughInvoke(&*BB, Invoke, call2invoke)) {
        ++BB;
        continue;
      }
    if (ResumeInst *RI = dyn_cast<ResumeInst>(BB->getTerminator()))
      Invoke.forwardResume(RI);
  }
  InvokeDest->removePredecessor(II->getParent());
}
static void HandleInlinedInvoke ( InvokeInst * II , BasicBlock * FirstNewBlock , ClonedCodeInfo & InlinedCodeInfo , CallsPromotedToInvoke & call2invoke ) { BasicBlock * InvokeDest = II -> getUnwindDest ( ) ; Function * Caller = FirstNewBlock -> getParent ( ) ; if ( ! InlinedCodeInfo . ContainsCalls ) { InvokeDest -> removePredecessor ( II -> getParent ( ) ) ; return ; } InvokeInliningInfo Invoke ( II ) ; Function :: iterator BB ( FirstNewBlock ) ; for ( Function :: iterator E = Caller -> end ( ) ; BB != E ; ++ BB ) { if ( InlinedCodeInfo . ContainsCalls ) if ( HandleCallsInBlockInlinedThroughInvoke ( & * BB , Invoke , call2invoke ) ) { ++ BB ; continue ; } if ( ResumeInst * RI = dyn_cast < ResumeInst > ( BB -> getTerminator ( ) ) ) Invoke . forwardResume ( RI ) ; } InvokeDest -> removePredecessor ( II -> getParent ( ) ) ; }
HandleInlinedInvoke - If we inlined an invoke site, we need to convert calls
in the body of the inlined function into invokes.
HandleInlinedInvoke - If we inlined an invoke site we need to convert calls in the body of the inlined function into invokes .
// The inlined code is currently at the end of the function, scan from the // start of the inlined code to its end, checking for stuff we need to // rewrite.  If the code doesn't have calls or unwinds, we know there is // nothing to rewrite. // Now that everything is happy, we have one final detail.  The PHI nodes in // the exception destination block still have entries due to the original // invoke instruction.  Eliminate these entries (which might even delete the // PHI node) now. // Honor a request to skip the next block. // Now that everything is happy, we have one final detail.  The PHI nodes in // the exception destination block still have entries due to the original // invoke instruction.  Eliminate these entries (which might even delete the // PHI node) now.