[llvm-commits] [llvm] r51207 - /llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
Dale Johannesen
dalej at apple.com
Fri May 16 14:31:48 PDT 2008
Author: johannes
Date: Fri May 16 16:31:48 2008
New Revision: 51207
URL: http://llvm.org/viewvc/llvm-project?rev=51207&view=rev
Log:
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
Modified:
llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=51207&r1=51206&r2=51207&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Fri May 16 16:31:48 2008
@@ -64,6 +64,8 @@
// 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 @@
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()) {
More information about the llvm-commits
mailing list