ParamAttrsVector ParamAttrsVec;
const ParamAttrsList *PAL = F->getParamAttrs();
+ // Add any return attributes.
+ if (unsigned attrs = PAL ? PAL->getParamAttrs(0) : 0)
+ ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, attrs));
+
unsigned ArgIndex = 1;
for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E;
++I, ++ArgIndex) {
Instruction *Call = CS.getInstruction();
PAL = CS.getParamAttrs();
+ // Add any return attributes.
+ if (unsigned attrs = PAL ? PAL->getParamAttrs(0) : 0)
+ ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, attrs));
+
// Loop over the operands, inserting GEP and loads in the caller as
// appropriate.
CallSite::arg_iterator AI = CS.arg_begin();
--- /dev/null
+; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | grep nounwind | count 2
+
+define internal i32 @deref(i32* %x) nounwind {
+entry:
+ %tmp2 = load i32* %x, align 4 ; <i32> [#uses=1]
+ ret i32 %tmp2
+}
+
+define i32 @f(i32 %x) {
+entry:
+ %x_addr = alloca i32 ; <i32*> [#uses=2]
+ store i32 %x, i32* %x_addr, align 4
+ %tmp1 = call i32 @deref( i32* %x_addr ) nounwind ; <i32> [#uses=1]
+ ret i32 %tmp1
+}