diff options
author | Chris Lattner <sabre@nondot.org> | 2007-01-07 07:54:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-01-07 07:54:34 +0000 |
commit | a121fddf3c34938d866ac4bb67247a479dedcd1b (patch) | |
tree | 91dd3b7e40a1e904dd85bc854a5fa0d11ef83b3c /lib/Transforms/Utils/InlineFunction.cpp | |
parent | 6a98754ebbc211958297b0d20a77e8c3261c3708 (diff) |
prepare for adjustment to getOrInsertFunction method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r-- | lib/Transforms/Utils/InlineFunction.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index c49cc75ffb..83cdfb80c1 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -274,19 +274,21 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG) { // code with llvm.stacksave/llvm.stackrestore intrinsics. if (InlinedFunctionInfo.ContainsDynamicAllocas) { Module *M = Caller->getParent(); - const Type *SBytePtr = PointerType::get(Type::Int8Ty); + const Type *BytePtr = PointerType::get(Type::Int8Ty); // Get the two intrinsics we care about. - Function *StackSave, *StackRestore; - StackSave = M->getOrInsertFunction("llvm.stacksave", SBytePtr, NULL); + Constant *StackSave, *StackRestore; + StackSave = M->getOrInsertFunction("llvm.stacksave", BytePtr, NULL); StackRestore = M->getOrInsertFunction("llvm.stackrestore", Type::VoidTy, - SBytePtr, NULL); + BytePtr, NULL); // If we are preserving the callgraph, add edges to the stacksave/restore // functions for the calls we insert. CallGraphNode *StackSaveCGN = 0, *StackRestoreCGN = 0, *CallerNode = 0; if (CG) { - StackSaveCGN = CG->getOrInsertFunction(StackSave); - StackRestoreCGN = CG->getOrInsertFunction(StackRestore); + // We know that StackSave/StackRestore are Function*'s, because they are + // intrinsics which must have the right types. + StackSaveCGN = CG->getOrInsertFunction(cast<Function>(StackSave)); + StackRestoreCGN = CG->getOrInsertFunction(cast<Function>(StackRestore)); CallerNode = (*CG)[Caller]; } |