[llvm-commits] CVS: llvm/lib/Transforms/Utils/InlineFunction.cpp

Chris Lattner sabre at nondot.org
Sat Jan 6 23:54:49 PST 2007



Changes in directory llvm/lib/Transforms/Utils:

InlineFunction.cpp updated: 1.48 -> 1.49
---
Log message:

prepare for adjustment to getOrInsertFunction method


---
Diffs of the changes:  (+8 -6)

 InlineFunction.cpp |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)


Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.48 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.49
--- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.48	Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/Utils/InlineFunction.cpp	Sun Jan  7 01:54:34 2007
@@ -274,19 +274,21 @@
   // 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];
     }
       






More information about the llvm-commits mailing list