llvm.org GIT mirror llvm / 532d022
Don't drop function/call return attributes like 'nounwind'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46645 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan Sands 11 years ago
2 changed file(s) with 23 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
403403 ParamAttrsVector ParamAttrsVec;
404404 const ParamAttrsList *PAL = F->getParamAttrs();
405405
406 // Add any return attributes.
407 if (unsigned attrs = PAL ? PAL->getParamAttrs(0) : 0)
408 ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, attrs));
409
406410 unsigned ArgIndex = 1;
407411 for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E;
408412 ++I, ++ArgIndex) {
490494 Instruction *Call = CS.getInstruction();
491495 PAL = CS.getParamAttrs();
492496
497 // Add any return attributes.
498 if (unsigned attrs = PAL ? PAL->getParamAttrs(0) : 0)
499 ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, attrs));
500
493501 // Loop over the operands, inserting GEP and loads in the caller as
494502 // appropriate.
495503 CallSite::arg_iterator AI = CS.arg_begin();
0 ; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | grep nounwind | count 2
1
2 define internal i32 @deref(i32* %x) nounwind {
3 entry:
4 %tmp2 = load i32* %x, align 4 ; [#uses=1]
5 ret i32 %tmp2
6 }
7
8 define i32 @f(i32 %x) {
9 entry:
10 %x_addr = alloca i32 ; [#uses=2]
11 store i32 %x, i32* %x_addr, align 4
12 %tmp1 = call i32 @deref( i32* %x_addr ) nounwind ; [#uses=1]
13 ret i32 %tmp1
14 }