summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-03-04 01:53:05 +0000
committerDale Johannesen <dalej@apple.com>2009-03-04 01:53:05 +0000
commitc8b5a6ef7d2e4212db9d6d0866474d47deb7172a (patch)
tree0b1f32b0b314c838333d388671e52d228f30bc0f /llvm/lib/Transforms/Utils/InlineFunction.cpp
parentb8905c4e2c3902fe59ca9715441eec2386890f24 (diff)
downloadbcm5719-llvm-c8b5a6ef7d2e4212db9d6d0866474d47deb7172a.tar.gz
bcm5719-llvm-c8b5a6ef7d2e4212db9d6d0866474d47deb7172a.zip
Always skip ptr-to-ptr bitcasts when counting,
per Chris' suggestion. Slightly faster. llvm-svn: 65999
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index a96c7ceaa8e..9cd38cc55e0 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -235,7 +235,7 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
// function.
std::vector<ReturnInst*> Returns;
ClonedCodeInfo InlinedFunctionInfo;
- Function::iterator FirstNewBlock;
+ Function::iterator FirstNewBlock, LastNewBlock;
{ // Scope to destroy ValueMap after cloning.
DenseMap<const Value*, Value*> ValueMap;
@@ -312,6 +312,7 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
// Remember the first block that is newly cloned over.
FirstNewBlock = LastBlock; ++FirstNewBlock;
+ LastNewBlock = &Caller->back();
// Update the callgraph if requested.
if (CG)
@@ -537,7 +538,9 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
// Add a branch to the merge points and remove return instructions.
for (unsigned i = 0, e = Returns.size(); i != e; ++i) {
ReturnInst *RI = Returns[i];
- BranchInst::Create(AfterCallBB, RI);
+ // A return in the last block in the function falls through.
+// if (isa<InvokeInst>(TheCall) || RI->getParent() != LastNewBlock)
+ BranchInst::Create(AfterCallBB, RI);
RI->eraseFromParent();
}
} else if (!Returns.empty()) {
OpenPOWER on IntegriCloud