}
/// @brief Determine if the function cannot return.
- bool isNoReturn() const {
+ bool doesNotReturn() const {
return paramHasAttr(0, ParamAttr::NoReturn);
}
/// @brief Determine if the function cannot unwind.
- bool isNoUnwind() const {
+ bool doesNotThrow() const {
return paramHasAttr(0, ParamAttr::NoUnwind);
}
}
/// @brief Determine if the call cannot return.
- bool isNoReturn() const {
+ bool doesNotReturn() const {
return paramHasAttr(0, ParamAttr::NoReturn);
}
/// @brief Determine if the call cannot unwind.
- bool isNoUnwind() const {
+ bool doesNotThrow() const {
return paramHasAttr(0, ParamAttr::NoUnwind);
}
}
/// @brief Determine if the call cannot return.
- bool isNoReturn() const {
+ bool doesNotReturn() const {
return paramHasAttr(0, ParamAttr::NoReturn);
}
/// @brief Determine if the call cannot unwind.
- bool isNoUnwind() const {
+ bool doesNotThrow() const {
return paramHasAttr(0, ParamAttr::NoUnwind);
}
bool onlyReadsMemory() const;
/// @brief Determine if the call cannot unwind.
- bool isNoUnwind() const;
+ bool doesNotThrow() const;
/// getType - Return the type of the instruction that generated this call site
///
SCCMightUnwind = true;
SCCMightReturn = true;
} else if (F->isDeclaration()) {
- SCCMightUnwind |= !F->isNoUnwind();
- SCCMightReturn |= !F->isNoReturn();
+ SCCMightUnwind |= !F->doesNotThrow();
+ SCCMightReturn |= !F->doesNotReturn();
} else {
- bool CheckUnwind = !SCCMightUnwind && !F->isNoUnwind();
- bool CheckReturn = !SCCMightReturn && !F->isNoReturn();
+ bool CheckUnwind = !SCCMightUnwind && !F->doesNotThrow();
+ bool CheckReturn = !SCCMightReturn && !F->doesNotReturn();
if (!CheckUnwind && !CheckReturn)
continue;
if (CheckUnwind && !SCCMightUnwind)
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
if (CallInst *CI = dyn_cast<CallInst>(I)) {
- if (CI->isNoUnwind()) {
+ if (CI->doesNotThrow()) {
// This call cannot throw.
} else if (Function *Callee = CI->getCalledFunction()) {
CallGraphNode *CalleeNode = CG[Callee];
bool MadeChange = false;
for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
- if (II->isNoUnwind()) {
+ if (II->doesNotThrow()) {
SmallVector<Value*, 8> Args(II->op_begin()+3, II->op_end());
// Insert a call instruction before the invoke.
CallInst *Call = new CallInst(II->getCalledValue(),
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; )
if (CallInst *CI = dyn_cast<CallInst>(I++))
- if (CI->isNoReturn() && !isa<UnreachableInst>(I)) {
+ if (CI->doesNotReturn() && !isa<UnreachableInst>(I)) {
// This call calls a function that cannot return. Insert an
// unreachable instruction after it and simplify the code. Do this
// by splitting the BB, adding the unreachable, then deleting the
}
}
- if (isa<InlineAsm>(Callee) && !CS.isNoUnwind()) {
+ if (isa<InlineAsm>(Callee) && !CS.paramHasAttr(0, ParamAttr::NoUnwind)) {
// Inline asm calls cannot throw - mark them 'nounwind'.
const ParamAttrsList *PAL = CS.getParamAttrs();
uint16_t RAttributes = PAL ? PAL->getParamAttrs(0) : 0;
// canonicalizes unreachable insts into stores to null or undef.
for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E;++BBI){
if (CallInst *CI = dyn_cast<CallInst>(BBI)) {
- if (CI->isNoReturn()) {
+ if (CI->doesNotReturn()) {
// If we found a call to a no-return function, insert an unreachable
// instruction after it. Make sure there isn't *already* one there
// though.
// Turn invokes that call 'nounwind' functions into ordinary calls.
if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
- if (II->isNoUnwind()) {
+ if (II->doesNotThrow()) {
ChangeToCall(II);
Changed = true;
}
CallInst *CI = cast<CallInst>(I);
// If this call cannot unwind, don't convert it to an invoke.
- if (CI->isNoUnwind())
+ if (CI->doesNotThrow())
continue;
// Convert this function call into an invoke instruction.
else
return cast<InvokeInst>(I)->onlyReadsMemory();
}
-bool CallSite::isNoUnwind() const {
+bool CallSite::doesNotThrow() const {
if (CallInst *CI = dyn_cast<CallInst>(I))
- return CI->isNoUnwind();
+ return CI->doesNotThrow();
else
- return cast<InvokeInst>(I)->isNoUnwind();
+ return cast<InvokeInst>(I)->doesNotThrow();
}
//===----------------------------------------------------------------------===//