Don't inline functions that take variable numbers of arguments!
authorChris Lattner <sabre@nondot.org>
Thu, 8 May 2003 02:36:43 +0000 (02:36 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 8 May 2003 02:36:43 +0000 (02:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6024 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/InlineSimple.cpp

index 5175bfd2c3ae255e371326b88c880b456876ea9a..a45c4546f8290dcce848ea3ada250b2408606e96 100644 (file)
@@ -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 @@ bool InlineFunction(CallInst *CI) {
   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";