[llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Jun 18 11:27:01 PDT 2003


Changes in directory llvm/lib/Transforms/IPO:

DeadArgumentElimination.cpp updated: 1.1 -> 1.2

---
Log message:

Handle arguments passed in through the va_arg area


---
Diffs of the changes:

Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.1 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.2
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.1	Tue Jun 17 17:21:05 2003
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp	Wed Jun 18 11:25:51 2003
@@ -79,7 +79,13 @@
     Function *Callee = CS.getCalledFunction();
     if (!Callee) return Alive;
 
-    // FIXME: check to see if it's passed through a va_arg area
+    // Check to see if it's passed through a va_arg area: if so, we cannot
+    // remove it.
+    unsigned NumFixedArgs = Callee->getFunctionType()->getNumParams();
+    for (CallSite::arg_iterator AI = CS.arg_begin()+NumFixedArgs;
+         AI != CS.arg_end(); ++AI)
+      if (AI->get() == &A) // If passed through va_arg area, we cannot remove it
+        return Alive;
   }
 
   return MaybeLive;  // It must be used, but only as argument to a function





More information about the llvm-commits mailing list