Author: baldrick Date: Fri Nov 30 12:19:15 2007 New Revision: 44456 URL: http://llvm.org/viewvc/llvm-project?rev=44456&view=rev Log: Add the nounwind attribute to calls in nothrow regions.
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=44456&r1=44455&r2=44456&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Nov 30 12:19:15 2007 @@ -2311,7 +2311,6 @@ // call) and if so, what the exception destination will be. BasicBlock *LandingPad = 0; bool NoUnwind = false; - // FIXME: set the nounwind attribute if NoUnwind. // Do not turn intrinsic calls into invokes. if (!isa<Function>(Callee) || !cast<Function>(Callee)->getIntrinsicID()) { @@ -2342,6 +2341,17 @@ } } + if (NoUnwind && !(PAL && PAL->paramHasAttr(0, ParamAttr::NoUnwind))) { + // This particular call does not unwind even though the callee may + // unwind in general. Add the 'nounwind' attribute to the call. + uint16_t RAttributes = PAL ? PAL->getParamAttrs(0) : 0; + RAttributes |= ParamAttr::NoUnwind; + + ParamAttrsVector modVec; + modVec.push_back(ParamAttrsWithIndex::get(0, RAttributes)); + PAL = ParamAttrsList::getModified(PAL, modVec); + } + SmallVector<Value*, 16> CallOperands; CallingConv::ID CallingConvention; FunctionCallArgumentConversion Client(exp, CallOperands, CallingConvention, _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits