diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2008-01-17 04:18:54 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2008-01-17 04:18:54 +0000 |
| commit | 04af661b1ff4b63595713e47d9d78ca838fcf33f (patch) | |
| tree | f317cf3acdfb0851ce29c9ed30c9655cd0739959 /llvm/lib/Transforms | |
| parent | 16808a32f46ec1c78f0e51f5183dee47278f9cdc (diff) | |
| download | bcm5719-llvm-04af661b1ff4b63595713e47d9d78ca838fcf33f.tar.gz bcm5719-llvm-04af661b1ff4b63595713e47d9d78ca838fcf33f.zip | |
DAE bug fix. Don't lose parameter attributes on vararg arguments.
llvm-svn: 46113
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index b8770121eb0..3a4c36f87f1 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/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)) { |

