diff options
author | Chris Lattner <sabre@nondot.org> | 2003-01-13 00:27:23 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-01-13 00:27:23 +0000 |
commit | 661841c49b549c49e918648f957c1668d242312d (patch) | |
tree | f5b84f1c0c73d8b1addb51868ff6c5885979c927 /llvm/lib/Transforms/IPO/InlineSimple.cpp | |
parent | 0d5644bb6d6a0117e3bc59c37322118b380b9f8e (diff) | |
download | bcm5719-llvm-661841c49b549c49e918648f957c1668d242312d.tar.gz bcm5719-llvm-661841c49b549c49e918648f957c1668d242312d.zip |
Fix references to functions
llvm-svn: 5222
Diffstat (limited to 'llvm/lib/Transforms/IPO/InlineSimple.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/InlineSimple.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/IPO/InlineSimple.cpp b/llvm/lib/Transforms/IPO/InlineSimple.cpp index 6dbab594e8c..afa4890f035 100644 --- a/llvm/lib/Transforms/IPO/InlineSimple.cpp +++ b/llvm/lib/Transforms/IPO/InlineSimple.cpp @@ -8,13 +8,8 @@ // * Is able to inline ANY function call // . Has a smart heuristic for when to inline a function // -// Notice that: -// * This pass opens up a lot of opportunities for constant propogation. It -// is a good idea to to run a constant propogation pass, then a DCE pass -// sometime after running this pass. -// // FIXME: This pass should transform alloca instructions in the called function -// into malloc/free pairs! +// into malloc/free pairs! Or perhaps it should refuse to inline them! // //===----------------------------------------------------------------------===// @@ -105,6 +100,13 @@ bool InlineFunction(CallInst *CI) { // Make a vector to capture the return instructions in the cloned function... std::vector<ReturnInst*> Returns; + // Populate the value map with all of the globals in the program. + Module &M = *OrigBB->getParent()->getParent(); + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + ValueMap[I] = I; + for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) + ValueMap[I] = I; + // Do all of the hard part of cloning the callee into the caller... CloneFunctionInto(OrigBB->getParent(), CalledFunc, ValueMap, Returns, ".i"); |