Fix PR4909, patch by Jakub Staszak.

llvm-svn: 81250
This commit is contained in:
Owen Anderson 2009-09-08 19:53:15 +00:00
parent eaf0f7f20b
commit b32b599081
2 changed files with 17 additions and 1 deletions

View File

@ -48,7 +48,8 @@ ModulePass* llvm::createPartialInliningPass() { return new PartialInliner(); }
Function* PartialInliner::unswitchFunction(Function* F) {
// First, verify that this function is an unswitching candidate...
BasicBlock* entryBlock = F->begin();
if (!isa<BranchInst>(entryBlock->getTerminator()))
BranchInst *BR = dyn_cast<BranchInst>(entryBlock->getTerminator());
if (!BR || BR->isUnconditional())
return 0;
BasicBlock* returnBlock = 0;

View File

@ -0,0 +1,15 @@
; RUN: llvm-as < %s | opt -partial-inliner -disable-output
define i32 @f() {
entry:
br label %return
return: ; preds = %entry
ret i32 undef
}
define i32 @g() {
entry:
%0 = call i32 @f()
ret i32 %0
}