[llvm-commits] [llvm] r48262 - in /llvm/trunk: lib/Transforms/IPO/StructRetPromotion.cpp test/Transforms/SRETPromotion/2008-03-11-attributes.ll
Devang Patel
dpatel at apple.com
Tue Mar 11 17:07:03 PDT 2008
Author: dpatel
Date: Tue Mar 11 19:07:03 2008
New Revision: 48262
URL: http://llvm.org/viewvc/llvm-project?rev=48262&view=rev
Log:
Fix attribute handling.
Added:
llvm/trunk/test/Transforms/SRETPromotion/2008-03-11-attributes.ll
Modified:
llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
Modified: llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp?rev=48262&r1=48261&r2=48262&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/StructRetPromotion.cpp Tue Mar 11 19:07:03 2008
@@ -210,17 +210,17 @@
// 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 @@
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;
}
Added: llvm/trunk/test/Transforms/SRETPromotion/2008-03-11-attributes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SRETPromotion/2008-03-11-attributes.ll?rev=48262&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/SRETPromotion/2008-03-11-attributes.ll (added)
+++ llvm/trunk/test/Transforms/SRETPromotion/2008-03-11-attributes.ll Tue Mar 11 19:07:03 2008
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | opt -sretpromotion -disable-output
+ %struct.ObjPoint = type { double, double, double, double, double, double }
+
+define void @RotatePoint(%struct.ObjPoint* sret %agg.result, %struct.ObjPoint* byval %a, double %rx, double %ry, double %rz) nounwind {
+entry:
+ unreachable
+}
More information about the llvm-commits
mailing list