Eliminate static ctors due to Statistic objects
[oota-llvm.git] / lib / Transforms / IPO / DeadArgumentElimination.cpp
index 77ac8737b0872985fafc4b24bbd4370f1188677e..9d88a8879fcddec8a1411d0e65255164191dca7f 100644 (file)
 #include <set>
 using namespace llvm;
 
-namespace {
-  Statistic<> NumArgumentsEliminated("deadargelim",
-                                     "Number of unread args removed");
-  Statistic<> NumRetValsEliminated("deadargelim",
-                                   "Number of unused return values removed");
+STATISTIC(NumArgumentsEliminated, "Number of unread args removed");
+STATISTIC(NumRetValsEliminated  , "Number of unused return values removed");
 
+namespace {
   /// DAE - The dead argument elimination pass.
   ///
   class DAE : public ModulePass {
@@ -499,8 +497,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 +526,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)