summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/PruneEH.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
commitf0c3354d998507515ab39e26b5292ea0ceb06aef (patch)
treed4442f54d211307d792ee586467e8a127c908365 /lib/Transforms/IPO/PruneEH.cpp
parent0a92af487b8ae5d004a3460e3518a3815d9b36a8 (diff)
downloadllvm-f0c3354d998507515ab39e26b5292ea0ceb06aef.tar.gz
llvm-f0c3354d998507515ab39e26b5292ea0ceb06aef.tar.bz2
llvm-f0c3354d998507515ab39e26b5292ea0ceb06aef.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45218 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/PruneEH.cpp')
-rw-r--r--lib/Transforms/IPO/PruneEH.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp
index 69bb1f67c7..529f98e504 100644
--- a/lib/Transforms/IPO/PruneEH.cpp
+++ b/lib/Transforms/IPO/PruneEH.cpp
@@ -122,17 +122,15 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
// If the SCC doesn't unwind or doesn't throw, note this fact.
if (!SCCMightUnwind || !SCCMightReturn)
for (unsigned i = 0, e = SCC.size(); i != e; ++i) {
- const ParamAttrsList *PAL = SCC[i]->getFunction()->getParamAttrs();
- uint16_t RAttributes = PAL ? PAL->getParamAttrs(0) : 0;
+ uint16_t NewAttributes = ParamAttr::None;
if (!SCCMightUnwind)
- RAttributes |= ParamAttr::NoUnwind;
+ NewAttributes |= ParamAttr::NoUnwind;
if (!SCCMightReturn)
- RAttributes |= ParamAttr::NoReturn;
+ NewAttributes |= ParamAttr::NoReturn;
- ParamAttrsVector modVec;
- modVec.push_back(ParamAttrsWithIndex::get(0, RAttributes));
- PAL = ParamAttrsList::getModified(PAL, modVec);
+ const ParamAttrsList *PAL = SCC[i]->getFunction()->getParamAttrs();
+ PAL = ParamAttrsList::includeAttrs(PAL, 0, NewAttributes);
SCC[i]->getFunction()->setParamAttrs(PAL);
}