mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
ArgumentPromotion: Remove ancient workaround for a bug in the C backend.
Fun fact: The CBE learned how to deal with this situation before it was removed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164918 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -592,14 +592,6 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
|||||||
|
|
||||||
Type *RetTy = FTy->getReturnType();
|
Type *RetTy = FTy->getReturnType();
|
||||||
|
|
||||||
// Work around LLVM bug PR56: the CWriter cannot emit varargs functions which
|
|
||||||
// have zero fixed arguments.
|
|
||||||
bool ExtraArgHack = false;
|
|
||||||
if (Params.empty() && FTy->isVarArg()) {
|
|
||||||
ExtraArgHack = true;
|
|
||||||
Params.push_back(Type::getInt32Ty(F->getContext()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Construct the new function type using the new arguments.
|
// Construct the new function type using the new arguments.
|
||||||
FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg());
|
FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg());
|
||||||
|
|
||||||
@@ -711,9 +703,6 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExtraArgHack)
|
|
||||||
Args.push_back(Constant::getNullValue(Type::getInt32Ty(F->getContext())));
|
|
||||||
|
|
||||||
// Push any varargs arguments on the list.
|
// Push any varargs arguments on the list.
|
||||||
for (; AI != CS.arg_end(); ++AI, ++ArgIndex) {
|
for (; AI != CS.arg_end(); ++AI, ++ArgIndex) {
|
||||||
Args.push_back(*AI);
|
Args.push_back(*AI);
|
||||||
@@ -870,16 +859,9 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Increment I2 past all of the arguments added for this promoted pointer.
|
// Increment I2 past all of the arguments added for this promoted pointer.
|
||||||
for (unsigned i = 0, e = ArgIndices.size(); i != e; ++i)
|
std::advance(I2, ArgIndices.size());
|
||||||
++I2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify the alias analysis implementation that we inserted a new argument.
|
|
||||||
if (ExtraArgHack)
|
|
||||||
AA.copyValue(Constant::getNullValue(Type::getInt32Ty(F->getContext())),
|
|
||||||
NF->arg_begin());
|
|
||||||
|
|
||||||
|
|
||||||
// Tell the alias analysis that the old function is about to disappear.
|
// Tell the alias analysis that the old function is about to disappear.
|
||||||
AA.replaceWithNewValue(F, NF);
|
AA.replaceWithNewValue(F, NF);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user