Fix PR4909, patch by Jakub Staszak.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81250 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2009-09-08 19:53:15 +00:00
parent c22675b542
commit a0ecbe7821
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
}