[llvm-commits] [llvm] r81250 - in /llvm/trunk: lib/Transforms/IPO/PartialInlining.cpp test/Transforms/Inline/PR4909.ll
Owen Anderson
resistor at mac.com
Tue Sep 8 12:53:15 PDT 2009
Author: resistor
Date: Tue Sep 8 14:53:15 2009
New Revision: 81250
URL: http://llvm.org/viewvc/llvm-project?rev=81250&view=rev
Log:
Fix PR4909, patch by Jakub Staszak.
Added:
llvm/trunk/test/Transforms/Inline/PR4909.ll
Modified:
llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp
Modified: llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp?rev=81250&r1=81249&r2=81250&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp Tue Sep 8 14:53:15 2009
@@ -48,7 +48,8 @@
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;
Added: llvm/trunk/test/Transforms/Inline/PR4909.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/PR4909.ll?rev=81250&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/Inline/PR4909.ll (added)
+++ llvm/trunk/test/Transforms/Inline/PR4909.ll Tue Sep 8 14:53:15 2009
@@ -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
+}
More information about the llvm-commits
mailing list