[llvm-commits] [release_19] CVS: llvm/lib/Transforms/IPO/Inliner.cpp
Tanya Lattner
tonic at nondot.org
Thu Nov 9 16:06:36 PST 2006
Changes in directory llvm/lib/Transforms/IPO:
Inliner.cpp updated: 1.30 -> 1.30.2.1
---
Log message:
Merging from mainline.
---
Diffs of the changes: (+17 -5)
Inliner.cpp | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
Index: llvm/lib/Transforms/IPO/Inliner.cpp
diff -u llvm/lib/Transforms/IPO/Inliner.cpp:1.30 llvm/lib/Transforms/IPO/Inliner.cpp:1.30.2.1
--- llvm/lib/Transforms/IPO/Inliner.cpp:1.30 Thu Nov 2 14:25:50 2006
+++ llvm/lib/Transforms/IPO/Inliner.cpp Thu Nov 9 18:06:24 2006
@@ -112,8 +112,13 @@
// Calls to external functions are never inlinable.
if (Callee->isExternal() ||
CallSites[CSi].getInstruction()->getParent()->getParent() ==Callee){
- std::swap(CallSites[CSi], CallSites.back());
- CallSites.pop_back();
+ if (SCC.size() == 1) {
+ std::swap(CallSites[CSi], CallSites.back());
+ CallSites.pop_back();
+ } else {
+ // Keep the 'in SCC / not in SCC' boundary correct.
+ CallSites.erase(CallSites.begin()+CSi);
+ }
--CSi;
continue;
}
@@ -131,9 +136,16 @@
// Attempt to inline the function...
if (InlineCallIfPossible(CS, CG, SCCFunctions)) {
- // Remove this call site from the list.
- std::swap(CallSites[CSi], CallSites.back());
- CallSites.pop_back();
+ // Remove this call site from the list. If possible, use
+ // swap/pop_back for efficiency, but do not use it if doing so would
+ // move a call site to a function in this SCC before the
+ // 'FirstCallInSCC' barrier.
+ if (SCC.size() == 1) {
+ std::swap(CallSites[CSi], CallSites.back());
+ CallSites.pop_back();
+ } else {
+ CallSites.erase(CallSites.begin()+CSi);
+ }
--CSi;
++NumInlined;
More information about the llvm-commits
mailing list