diff options
| author | Owen Anderson <resistor@mac.com> | 2009-09-08 19:53:15 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2009-09-08 19:53:15 +0000 |
| commit | f0081db7e89268661c09b51064995a97f905250d (patch) | |
| tree | 0e41a1b676f7d963e08cf82f8c6249cc7c1baa2b | |
| parent | 29b5d3012be0318b520958a3d33064f106c659f2 (diff) | |
| download | bcm5719-llvm-f0081db7e89268661c09b51064995a97f905250d.tar.gz bcm5719-llvm-f0081db7e89268661c09b51064995a97f905250d.zip | |
Fix PR4909, patch by Jakub Staszak.
llvm-svn: 81250
| -rw-r--r-- | llvm/lib/Transforms/IPO/PartialInlining.cpp | 3 | ||||
| -rw-r--r-- | llvm/test/Transforms/Inline/PR4909.ll | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/PartialInlining.cpp b/llvm/lib/Transforms/IPO/PartialInlining.cpp index 73ec9c10763..8f858d35ea3 100644 --- a/llvm/lib/Transforms/IPO/PartialInlining.cpp +++ b/llvm/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<BranchInst>(entryBlock->getTerminator())) + BranchInst *BR = dyn_cast<BranchInst>(entryBlock->getTerminator()); + if (!BR || BR->isUnconditional()) return 0; BasicBlock* returnBlock = 0; diff --git a/llvm/test/Transforms/Inline/PR4909.ll b/llvm/test/Transforms/Inline/PR4909.ll new file mode 100644 index 00000000000..48b2526f2b1 --- /dev/null +++ b/llvm/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 +} |

