[llvm-commits] CVS: llvm/lib/Transforms/IPO/Inliner.cpp Inliner.h
Chris Lattner
lattner at cs.uiuc.edu
Sat Nov 8 23:06:00 PST 2003
Changes in directory llvm/lib/Transforms/IPO:
Inliner.cpp updated: 1.3 -> 1.4
Inliner.h updated: 1.2 -> 1.3
---
Log message:
Do NOT inline self recursive calls into other functions. This is causing the
pool allocator no end of trouble, and doesn't make a lot of sense anyway. This
does not solve the problem with mutually recursive functions, but they are much less common.
---
Diffs of the changes: (+10 -1)
Index: llvm/lib/Transforms/IPO/Inliner.cpp
diff -u llvm/lib/Transforms/IPO/Inliner.cpp:1.3 llvm/lib/Transforms/IPO/Inliner.cpp:1.4
--- llvm/lib/Transforms/IPO/Inliner.cpp:1.3 Fri Oct 31 15:05:58 2003
+++ llvm/lib/Transforms/IPO/Inliner.cpp Sat Nov 8 23:05:36 2003
@@ -64,9 +64,12 @@
if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
CallSite CS = CallSite::get(I);
if (Function *Callee = CS.getCalledFunction())
- if (!Callee->isExternal()) {
+ if (!Callee->isExternal() && !IsRecursiveFunction.count(Callee)) {
// Determine whether this is a function IN the SCC...
bool inSCC = SCCFunctions.count(Callee);
+
+ // Keep track of whether this is a directly recursive function.
+ if (Callee == F) IsRecursiveFunction.insert(F);
// If the policy determines that we should inline this function,
// try to do so...
Index: llvm/lib/Transforms/IPO/Inliner.h
diff -u llvm/lib/Transforms/IPO/Inliner.h:1.2 llvm/lib/Transforms/IPO/Inliner.h:1.3
--- llvm/lib/Transforms/IPO/Inliner.h:1.2 Tue Oct 21 10:17:13 2003
+++ llvm/lib/Transforms/IPO/Inliner.h Sat Nov 8 23:05:36 2003
@@ -51,7 +51,13 @@
virtual int getRecursiveInlineCost(CallSite CS);
private:
+ // InlineThreshold - Cache the value here for easy access.
unsigned InlineThreshold;
+
+ // IsRecursiveFunction - This contains all functions which are directly
+ // recursive, which we do NOT want to inline into other functions.
+ std::set<Function*> IsRecursiveFunction;
+
bool performInlining(CallSite CS, std::set<Function*> &SCC);
};
More information about the llvm-commits
mailing list