diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-10 19:12:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-10 19:12:44 +0000 |
commit | 4568ed78934f2d14e6d10ece67ddc15bc8687fb8 (patch) | |
tree | 655d09beb0d741cdaa3c4966665c29b28ead463b /llvm/lib/Transforms | |
parent | 6a75ebb137832ffd21596c764de93d690ea58a95 (diff) | |
download | bcm5719-llvm-4568ed78934f2d14e6d10ece67ddc15bc8687fb8.tar.gz bcm5719-llvm-4568ed78934f2d14e6d10ece67ddc15bc8687fb8.zip |
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!
llvm-svn: 100944
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index 227602d19f5..191c62a3f66 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/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); |