summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/DeadArgumentElimination.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-10 19:12:44 +0000
committerChris Lattner <sabre@nondot.org>2010-04-10 19:12:44 +0000
commit5106dcd078832ae20e285081a25bb79ec85eae6a (patch)
treedb3f0dc7b5124894c1f5d86130d6790b627ac034 /lib/Transforms/IPO/DeadArgumentElimination.cpp
parent195d2dec10a7faef45e9f5b4002ed44b1f6627be (diff)
downloadllvm-5106dcd078832ae20e285081a25bb79ec85eae6a.tar.gz
llvm-5106dcd078832ae20e285081a25bb79ec85eae6a.tar.bz2
llvm-5106dcd078832ae20e285081a25bb79ec85eae6a.tar.xz
Implement support for varargs functions without any fixed
parameters in the CBE by implicitly adding a fixed argument. This allows eliminating a work-around from DAE. Patch by Sylvere Teissier! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100944 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/DeadArgumentElimination.cpp')
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp15
1 files changed, 0 insertions, 15 deletions
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 227602d19f..191c62a3f6 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -694,18 +694,6 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
AttrListPtr NewPAL = AttrListPtr::get(AttributesVec.begin(),
AttributesVec.end());
- // Work around LLVM bug PR56: the CWriter cannot emit varargs functions which
- // have zero fixed arguments.
- //
- // Note that we apply this hack for a vararg fuction that does not have any
- // arguments anymore, but did have them before (so don't bother fixing
- // functions that were already broken wrt CWriter).
- bool ExtraArgHack = false;
- if (Params.empty() && FTy->isVarArg() && FTy->getNumParams() != 0) {
- ExtraArgHack = true;
- Params.push_back(Type::getInt32Ty(F->getContext()));
- }
-
// Create the new function type based on the recomputed parameters.
FunctionType *NFTy = FunctionType::get(NRetTy, Params, FTy->isVarArg());
@@ -755,9 +743,6 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
AttributesVec.push_back(AttributeWithIndex::get(Args.size(), Attrs));
}
- if (ExtraArgHack)
- Args.push_back(UndefValue::get(Type::getInt32Ty(F->getContext())));
-
// Push any varargs arguments on the list. Don't forget their attributes.
for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) {
Args.push_back(*I);