aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO/StructRetPromotion.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-03-12 00:07:03 +0000
committerDevang Patel <dpatel@apple.com>2008-03-12 00:07:03 +0000
commit3ec7de712fb78f0d8f126a5e8e18f037e1bdf58b (patch)
tree8c1f6b72366f2ea37f2444206ae00465b736cfe7 /lib/Transforms/IPO/StructRetPromotion.cpp
parent7c76af2de9a06943da4cce9e356ca829da11c017 (diff)
downloadexternal_llvm-3ec7de712fb78f0d8f126a5e8e18f037e1bdf58b.zip
external_llvm-3ec7de712fb78f0d8f126a5e8e18f037e1bdf58b.tar.gz
external_llvm-3ec7de712fb78f0d8f126a5e8e18f037e1bdf58b.tar.bz2
Fix attribute handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/StructRetPromotion.cpp')
-rw-r--r--lib/Transforms/IPO/StructRetPromotion.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/Transforms/IPO/StructRetPromotion.cpp b/lib/Transforms/IPO/StructRetPromotion.cpp
index 686ffda..c6b561d 100644
--- a/lib/Transforms/IPO/StructRetPromotion.cpp
+++ b/lib/Transforms/IPO/StructRetPromotion.cpp
@@ -210,17 +210,17 @@ Function *SRETPromotion::cloneFunctionBody(Function *F,
// Skip first argument.
Function::arg_iterator I = F->arg_begin(), E = F->arg_end();
++I;
- unsigned ParamIndex = 1; // 0th parameter attribute is reserved for return type.
+ // 0th parameter attribute is reserved for return type.
+ // 1th parameter attribute is for first 1st sret argument.
+ unsigned ParamIndex = 2;
while (I != E) {
Params.push_back(I->getType());
- ParameterAttributes Attrs = ParamAttr::None;
if (PAL) {
- Attrs = PAL->getParamAttrs(ParamIndex);
- if (ParamIndex == 1) // Skip sret attribute
- Attrs = Attrs ^ ParamAttr::StructRet;
+ ParameterAttributes Attrs = PAL->getParamAttrs(ParamIndex);
+ if (Attrs != ParamAttr::None)
+ ParamAttrsVec.push_back(ParamAttrsWithIndex::get(ParamIndex - 1,
+ Attrs));
}
- if (Attrs != ParamAttr::None)
- ParamAttrsVec.push_back(ParamAttrsWithIndex::get(ParamIndex, Attrs));
++I;
++ParamIndex;
}
@@ -269,17 +269,17 @@ void SRETPromotion::updateCallSites(Function *F, Function *NF) {
CallSite::arg_iterator AI = CS.arg_begin(), AE = CS.arg_end();
Value *FirstCArg = *AI;
++AI;
- unsigned ParamIndex = 1; // 0th parameter attribute is reserved for return type.
+ // 0th parameter attribute is reserved for return type.
+ // 1th parameter attribute is for first 1st sret argument.
+ unsigned ParamIndex = 2;
while (AI != AE) {
Args.push_back(*AI);
- ParameterAttributes Attrs = ParamAttr::None;
if (PAL) {
- Attrs = PAL->getParamAttrs(ParamIndex);
- if (ParamIndex == 1) // Skip sret attribute
- Attrs = Attrs ^ ParamAttr::StructRet;
+ ParameterAttributes Attrs = PAL->getParamAttrs(ParamIndex);
+ if (Attrs != ParamAttr::None)
+ ArgAttrsVec.push_back(ParamAttrsWithIndex::get(ParamIndex - 1,
+ Attrs));
}
- if (Attrs != ParamAttr::None)
- ArgAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs));
++ParamIndex;
++AI;
}