[llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionInlining.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed May 7 21:37:01 PDT 2003


Changes in directory llvm/lib/Transforms/IPO:

FunctionInlining.cpp updated: 1.43 -> 1.44

---
Log message:

Don't inline functions that take variable numbers of arguments!


---
Diffs of the changes:

Index: llvm/lib/Transforms/IPO/FunctionInlining.cpp
diff -u llvm/lib/Transforms/IPO/FunctionInlining.cpp:1.43 llvm/lib/Transforms/IPO/FunctionInlining.cpp:1.44
--- llvm/lib/Transforms/IPO/FunctionInlining.cpp:1.43	Wed May  7 21:34:52 2003
+++ llvm/lib/Transforms/IPO/FunctionInlining.cpp	Wed May  7 21:36:43 2003
@@ -20,7 +20,7 @@
 #include "llvm/iTerminators.h"
 #include "llvm/iPHINode.h"
 #include "llvm/iOther.h"
-#include "llvm/Type.h"
+#include "llvm/DerivedTypes.h"
 #include "Support/Statistic.h"
 #include <algorithm>
 
@@ -42,8 +42,9 @@
   assert(CI->getParent()->getParent() && "Instruction not in function!");
 
   const Function *CalledFunc = CI->getCalledFunction();
-  if (CalledFunc == 0 ||   // Can't inline external function or indirect call!
-      CalledFunc->isExternal()) return false;
+  if (CalledFunc == 0 ||          // Can't inline external function or indirect
+      CalledFunc->isExternal() || // call, or call to a vararg function!
+      CalledFunc->getFunctionType()->isVarArg()) return false;
 
   //std::cerr << "Inlining " << CalledFunc->getName() << " into " 
   //     << CurrentMeth->getName() << "\n";





More information about the llvm-commits mailing list