Formatting cleanups. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149312 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2012-01-31 01:01:16 +00:00
parent 97cf71a517
commit 06881e8734

View File

@ -570,10 +570,9 @@ static bool HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB,
// Otherwise, create the new invoke instruction. // Otherwise, create the new invoke instruction.
ImmutableCallSite CS(CI); ImmutableCallSite CS(CI);
SmallVector<Value*, 8> InvokeArgs(CS.arg_begin(), CS.arg_end()); SmallVector<Value*, 8> InvokeArgs(CS.arg_begin(), CS.arg_end());
InvokeInst *II = InvokeInst *II = InvokeInst::Create(CI->getCalledValue(), Split,
InvokeInst::Create(CI->getCalledValue(), Split, Invoke.getOuterUnwindDest(),
Invoke.getOuterUnwindDest(), InvokeArgs, CI->getName(), BB);
InvokeArgs, CI->getName(), BB);
II->setCallingConv(CI->getCallingConv()); II->setCallingConv(CI->getCallingConv());
II->setAttributes(CI->getAttributes()); II->setAttributes(CI->getAttributes());
@ -581,17 +580,17 @@ static bool HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB,
// updates the CallGraph if present, because it uses a WeakVH. // updates the CallGraph if present, because it uses a WeakVH.
CI->replaceAllUsesWith(II); CI->replaceAllUsesWith(II);
Split->getInstList().pop_front(); // Delete the original call // Delete the original call
Split->getInstList().pop_front();
// Update any PHI nodes in the exceptional block to indicate that // Update any PHI nodes in the exceptional block to indicate that there is
// there is now a new entry in them. // now a new entry in them.
Invoke.addIncomingPHIValuesFor(BB); Invoke.addIncomingPHIValuesFor(BB);
return false; return false;
} }
return false; return false;
} }
/// HandleInlinedInvoke - If we inlined an invoke site, we need to convert calls /// HandleInlinedInvoke - If we inlined an invoke site, we need to convert calls
/// in the body of the inlined function into invokes and turn unwind /// in the body of the inlined function into invokes and turn unwind
@ -874,15 +873,15 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI,
} }
} }
// InlineFunction - This function inlines the called function into the basic /// InlineFunction - This function inlines the called function into the basic
// block of the caller. This returns false if it is not possible to inline this /// block of the caller. This returns false if it is not possible to inline
// call. The program is still in a well defined state if this occurs though. /// this call. The program is still in a well defined state if this occurs
// /// though.
// Note that this only does one level of inlining. For example, if the ///
// instruction 'call B' is inlined, and 'B' calls 'C', then the call to 'C' now /// Note that this only does one level of inlining. For example, if the
// exists in the instruction stream. Similarly this will inline a recursive /// instruction 'call B' is inlined, and 'B' calls 'C', then the call to 'C' now
// function by one level. /// exists in the instruction stream. Similarly this will inline a recursive
// /// function by one level.
bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI) { bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI) {
Instruction *TheCall = CS.getInstruction(); Instruction *TheCall = CS.getInstruction();
LLVMContext &Context = TheCall->getContext(); LLVMContext &Context = TheCall->getContext();
@ -934,7 +933,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI) {
// Find the personality function used by the landing pads of the caller. If it // Find the personality function used by the landing pads of the caller. If it
// exists, then check to see that it matches the personality function used in // exists, then check to see that it matches the personality function used in
// the callee. // the callee.
if (CalleePersonality) if (CalleePersonality) {
for (Function::const_iterator I = Caller->begin(), E = Caller->end(); for (Function::const_iterator I = Caller->begin(), E = Caller->end();
I != E; ++I) I != E; ++I)
if (const InvokeInst *II = dyn_cast<InvokeInst>(I->getTerminator())) { if (const InvokeInst *II = dyn_cast<InvokeInst>(I->getTerminator())) {
@ -950,6 +949,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI) {
break; break;
} }
}
// Get an iterator to the last basic block in the function, which will have // Get an iterator to the last basic block in the function, which will have
// the new function inlined after it. // the new function inlined after it.
@ -1016,7 +1016,6 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI) {
// block for the callee, move them to the entry block of the caller. First // block for the callee, move them to the entry block of the caller. First
// calculate which instruction they should be inserted before. We insert the // calculate which instruction they should be inserted before. We insert the
// instructions at the end of the current alloca list. // instructions at the end of the current alloca list.
//
{ {
BasicBlock::iterator InsertPoint = Caller->begin()->begin(); BasicBlock::iterator InsertPoint = Caller->begin()->begin();
for (BasicBlock::iterator I = FirstNewBlock->begin(), for (BasicBlock::iterator I = FirstNewBlock->begin(),
@ -1301,11 +1300,12 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI) {
// If we inserted a phi node, check to see if it has a single value (e.g. all // If we inserted a phi node, check to see if it has a single value (e.g. all
// the entries are the same or undef). If so, remove the PHI so it doesn't // the entries are the same or undef). If so, remove the PHI so it doesn't
// block other optimizations. // block other optimizations.
if (PHI) if (PHI) {
if (Value *V = SimplifyInstruction(PHI, IFI.TD)) { if (Value *V = SimplifyInstruction(PHI, IFI.TD)) {
PHI->replaceAllUsesWith(V); PHI->replaceAllUsesWith(V);
PHI->eraseFromParent(); PHI->eraseFromParent();
} }
}
return true; return true;
} }