summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-05-16 21:31:48 +0000
committerDale Johannesen <dalej@apple.com>2008-05-16 21:31:48 +0000
commite7f5bc2c3bfd0282a75a81326bae01cba9495043 (patch)
tree0c4c4472592ba57d146dfbeeaeb0c7e920c06ddd /llvm/lib/Transforms/IPO
parent901b1a75c93ca8b92977c246d3c9db567e83147f (diff)
downloadbcm5719-llvm-e7f5bc2c3bfd0282a75a81326bae01cba9495043.tar.gz
bcm5719-llvm-e7f5bc2c3bfd0282a75a81326bae01cba9495043.zip
Weak functions not declared non-throwing might be
replaced at linktime with a body that throws, even if the body in this file does not. Make PruneEH be more conservative in this case. g++.dg/eh/weak1.C llvm-svn: 51207
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r--llvm/lib/Transforms/IPO/PruneEH.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/PruneEH.cpp b/llvm/lib/Transforms/IPO/PruneEH.cpp
index ceb9e3e54e8..d2f3a8437cf 100644
--- a/llvm/lib/Transforms/IPO/PruneEH.cpp
+++ b/llvm/lib/Transforms/IPO/PruneEH.cpp
@@ -64,6 +64,8 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
// Next, check to see if any callees might throw or if there are any external
// functions in this SCC: if so, we cannot prune any functions in this SCC.
+ // Definitions that are weak and not declared non-throwing might be
+ // overridden at linktime with something that throws, so assume that.
// If this SCC includes the unwind instruction, we KNOW it throws, so
// obviously the SCC might throw.
//
@@ -71,7 +73,7 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
for (unsigned i = 0, e = SCC.size();
(!SCCMightUnwind || !SCCMightReturn) && i != e; ++i) {
Function *F = SCC[i]->getFunction();
- if (F == 0) {
+ if (F == 0 || (F->hasWeakLinkage() && !F->doesNotThrow())) {
SCCMightUnwind = true;
SCCMightReturn = true;
} else if (F->isDeclaration()) {
OpenPOWER on IntegriCloud