summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2007-12-19 21:13:37 +0000
committerDuncan Sands <baldrick@free.fr>2007-12-19 21:13:37 +0000
commitaa31b92508bf121b5a58be4cd794f16225f07f2d (patch)
treeebdbd951790a83af69a87d51cc4e71b049da6458 /llvm/lib/VMCore/Instructions.cpp
parenta246e09aa019e2048063dfd28765cf46417fc7f1 (diff)
downloadbcm5719-llvm-aa31b92508bf121b5a58be4cd794f16225f07f2d.tar.gz
bcm5719-llvm-aa31b92508bf121b5a58be4cd794f16225f07f2d.zip
When inlining through an 'nounwind' call, mark inlined
calls 'nounwind'. It is important for correct C++ exception handling that nounwind markings do not get lost, so this transformation is actually needed for correctness. llvm-svn: 45218
Diffstat (limited to 'llvm/lib/VMCore/Instructions.cpp')
-rw-r--r--llvm/lib/VMCore/Instructions.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 3531bad2e49..b76b11d4f63 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -71,6 +71,12 @@ bool CallSite::doesNotThrow() const {
else
return cast<InvokeInst>(I)->doesNotThrow();
}
+void CallSite::setDoesNotThrow(bool doesNotThrow) {
+ if (CallInst *CI = dyn_cast<CallInst>(I))
+ CI->setDoesNotThrow(doesNotThrow);
+ else
+ cast<InvokeInst>(I)->setDoesNotThrow(doesNotThrow);
+}
//===----------------------------------------------------------------------===//
// TerminatorInst Class
@@ -405,6 +411,15 @@ bool CallInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
return false;
}
+void CallInst::setDoesNotThrow(bool doesNotThrow) {
+ const ParamAttrsList *PAL = getParamAttrs();
+ if (doesNotThrow)
+ PAL = ParamAttrsList::includeAttrs(PAL, 0, ParamAttr::NoUnwind);
+ else
+ PAL = ParamAttrsList::excludeAttrs(PAL, 0, ParamAttr::NoUnwind);
+ setParamAttrs(PAL);
+}
+
//===----------------------------------------------------------------------===//
// InvokeInst Implementation
@@ -483,6 +498,15 @@ bool InvokeInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
return false;
}
+void InvokeInst::setDoesNotThrow(bool doesNotThrow) {
+ const ParamAttrsList *PAL = getParamAttrs();
+ if (doesNotThrow)
+ PAL = ParamAttrsList::includeAttrs(PAL, 0, ParamAttr::NoUnwind);
+ else
+ PAL = ParamAttrsList::excludeAttrs(PAL, 0, ParamAttr::NoUnwind);
+ setParamAttrs(PAL);
+}
+
//===----------------------------------------------------------------------===//
// ReturnInst Implementation
OpenPOWER on IntegriCloud