summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-01-17 04:18:54 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-01-17 04:18:54 +0000
commitb2fc2a330a9106c67d50a2b6dbfffc679af4ce88 (patch)
tree0263fc377964a65a616176844a9b8db53a2fd728 /lib/Transforms/IPO
parent3de01e10aeb384fbb4ffc92fa046b10db2485261 (diff)
downloadllvm-b2fc2a330a9106c67d50a2b6dbfffc679af4ce88.tar.gz
llvm-b2fc2a330a9106c67d50a2b6dbfffc679af4ce88.tar.bz2
llvm-b2fc2a330a9106c67d50a2b6dbfffc679af4ce88.tar.xz
DAE bug fix. Don't lose parameter attributes on vararg arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46113 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index b8770121eb..3a4c36f87f 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -590,15 +590,19 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
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)) {