From: Owen Anderson Date: Tue, 8 Sep 2009 19:53:15 +0000 (+0000) Subject: Fix PR4909, patch by Jakub Staszak. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=a0ecbe782177d3ec7c98700434d2d92fb0c0e600 Fix PR4909, patch by Jakub Staszak. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81250 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/IPO/PartialInlining.cpp b/lib/Transforms/IPO/PartialInlining.cpp index 73ec9c10763..8f858d35ea3 100644 --- a/lib/Transforms/IPO/PartialInlining.cpp +++ b/lib/Transforms/IPO/PartialInlining.cpp @@ -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(entryBlock->getTerminator())) + BranchInst *BR = dyn_cast(entryBlock->getTerminator()); + if (!BR || BR->isUnconditional()) return 0; BasicBlock* returnBlock = 0; diff --git a/test/Transforms/Inline/PR4909.ll b/test/Transforms/Inline/PR4909.ll new file mode 100644 index 00000000000..48b2526f2b1 --- /dev/null +++ b/test/Transforms/Inline/PR4909.ll @@ -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 +}