Author: evancheng
Date: Wed Jan 16 22:18:54 2008
New Revision: 46113

URL: http://llvm.org/viewvc/llvm-project?rev=46113&view=rev
Log:
DAE bug fix. Don't lose parameter attributes on vararg arguments.

Modified:
    llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp

Modified: llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=46113&r1=46112&r2=46113&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp Wed Jan 16 
22:18:54 2008
@@ -590,15 +590,19 @@
           ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), 
Attrs));
       }
 
-    // Reconstruct the ParamAttrsList based on the vector we constructed.
-    PAL = ParamAttrsList::get(ParamAttrsVec);
-
     if (ExtraArgHack)
       Args.push_back(UndefValue::get(Type::Int32Ty));
 
-    // Push any varargs arguments on the list
-    for (; AI != CS.arg_end(); ++AI)
+    // Push any varargs arguments on the list. Don't forget their attributes.
+    for (; AI != CS.arg_end(); ++AI) {
       Args.push_back(*AI);
+      uint16_t Attrs = PAL ? PAL->getParamAttrs(index++) : 0;
+      if (Attrs)
+        ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs));
+    }
+
+    // Reconstruct the ParamAttrsList based on the vector we constructed.
+    PAL = ParamAttrsList::get(ParamAttrsVec);
 
     Instruction *New;
     if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {


_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to