Support indirect calls

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@764 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-10-13 06:52:31 +00:00
parent 01bad7fbda
commit 5a0d4179df

View File

@ -69,7 +69,8 @@ bool opt::InlineMethod(BasicBlock::iterator CIIt) {
CallInst *CI = cast<CallInst>(*CIIt); CallInst *CI = cast<CallInst>(*CIIt);
const Method *CalledMeth = CI->getCalledMethod(); const Method *CalledMeth = CI->getCalledMethod();
if (CalledMeth->isExternal()) return false; // Can't inline external method! if (CalledMeth == 0 || // Can't inline external method or indirect call!
CalledMeth->isExternal()) return false;
Method *CurrentMeth = CI->getParent()->getParent(); Method *CurrentMeth = CI->getParent()->getParent();
//cerr << "Inlining " << CalledMeth->getName() << " into " //cerr << "Inlining " << CalledMeth->getName() << " into "
@ -238,7 +239,7 @@ static inline bool DoMethodInlining(BasicBlock *BB) {
if (CallInst *CI = dyn_cast<CallInst>(*I)) { if (CallInst *CI = dyn_cast<CallInst>(*I)) {
// Check to see if we should inline this method // Check to see if we should inline this method
Method *M = CI->getCalledMethod(); Method *M = CI->getCalledMethod();
if (ShouldInlineMethod(CI, M)) if (M && ShouldInlineMethod(CI, M))
return InlineMethod(I); return InlineMethod(I);
} }
} }