aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-08 02:36:43 +0000
committerChris Lattner <sabre@nondot.org>2003-05-08 02:36:43 +0000
commit8d8f20e47a7aaf75863d71d729283a60fce5c810 (patch)
treef3520295b9d57e2980f87a38ead57d37c6aee85e
parent1b27cb7159bcd0130cd1a98332b8952f4751867f (diff)
Don't inline functions that take variable numbers of arguments!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6024 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index 5175bfd2c3..a45c4546f8 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -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";