when inserting a dummy argument to work-around the CBE not supporting
authorChris Lattner <sabre@nondot.org>
Sat, 16 Dec 2006 21:21:53 +0000 (21:21 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 16 Dec 2006 21:21:53 +0000 (21:21 +0000)
zero arg vararg functions, pass undef instead of 'int 0', which is cheaper.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32634 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/DeadArgumentElimination.cpp

index d3326ac71f8d3f9389cd53416e11748ade20b77b..dbcc5018906cc140a23ad889e2248c4426e7a611 100644 (file)
@@ -499,8 +499,6 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
   // Work around LLVM bug PR56: the CWriter cannot emit varargs functions which
   // have zero fixed arguments.
   //
-  // FIXME: once this bug is fixed in the CWriter, this hack should be removed.
-  //
   bool ExtraArgHack = false;
   if (Params.empty() && FTy->isVarArg()) {
     ExtraArgHack = true;
@@ -530,7 +528,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
         Args.push_back(*AI);
 
     if (ExtraArgHack)
-      Args.push_back(Constant::getNullValue(Type::IntTy));
+      Args.push_back(UndefValue::get(Type::IntTy));
 
     // Push any varargs arguments on the list
     for (; AI != CS.arg_end(); ++AI)