[llvm-commits] CVS: llvm/lib/Transforms/IPO/PruneEH.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Apr 11 23:08:01 PDT 2004
Changes in directory llvm/lib/Transforms/IPO:
PruneEH.cpp updated: 1.12 -> 1.13
---
Log message:
Simplify code a bit, and be sure to mark the external node as potentially throwing
---
Diffs of the changes: (+31 -31)
Index: llvm/lib/Transforms/IPO/PruneEH.cpp
diff -u llvm/lib/Transforms/IPO/PruneEH.cpp:1.12 llvm/lib/Transforms/IPO/PruneEH.cpp:1.13
--- llvm/lib/Transforms/IPO/PruneEH.cpp:1.12 Fri Feb 13 10:46:46 2004
+++ llvm/lib/Transforms/IPO/PruneEH.cpp Sun Apr 11 23:06:38 2004
@@ -51,43 +51,43 @@
// obviously the SCC might throw.
//
bool SCCMightThrow = false;
- for (unsigned i = 0, e = SCC.size(); !SCCMightThrow && i != e; ++i)
- if (Function *F = SCC[i]->getFunction())
- if (F->isExternal() && !F->getIntrinsicID()) {
- SCCMightThrow = true;
- } else {
- // Check to see if this function performs an unwind or calls an
- // unwinding function.
- for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
- if (isa<UnwindInst>(BB->getTerminator())) { // Uses unwind!
- SCCMightThrow = true;
- break;
- }
+ for (unsigned i = 0, e = SCC.size(); !SCCMightThrow && i != e; ++i) {
+ Function *F = SCC[i]->getFunction();
+ if (F == 0 || (F->isExternal() && !F->getIntrinsicID())) {
+ SCCMightThrow = true;
+ } else {
+ // Check to see if this function performs an unwind or calls an
+ // unwinding function.
+ for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) {
+ if (isa<UnwindInst>(BB->getTerminator())) { // Uses unwind!
+ SCCMightThrow = true;
+ break;
+ }
- // Invoke instructions don't allow unwinding to continue, so we are
- // only interested in call instructions.
- for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
- if (CallInst *CI = dyn_cast<CallInst>(I)) {
- if (Function *Callee = CI->getCalledFunction()) {
- CallGraphNode *CalleeNode = CG[Callee];
- // If the callee is outside our current SCC, or if it is not
- // known to throw, then we might throw also.
- if (std::find(SCC.begin(), SCC.end(), CalleeNode) == SCC.end()&&
- !DoesNotThrow.count(CalleeNode)) {
- SCCMightThrow = true;
- break;
- }
-
- } else {
- // Indirect call, it might throw.
+ // Invoke instructions don't allow unwinding to continue, so we are
+ // only interested in call instructions.
+ for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I)
+ if (CallInst *CI = dyn_cast<CallInst>(I)) {
+ if (Function *Callee = CI->getCalledFunction()) {
+ CallGraphNode *CalleeNode = CG[Callee];
+ // If the callee is outside our current SCC, or if it is not
+ // known to throw, then we might throw also.
+ if (std::find(SCC.begin(), SCC.end(), CalleeNode) == SCC.end()&&
+ !DoesNotThrow.count(CalleeNode)) {
SCCMightThrow = true;
break;
}
+
+ } else {
+ // Indirect call, it might throw.
+ SCCMightThrow = true;
+ break;
}
- if (SCCMightThrow) break;
- }
+ }
+ if (SCCMightThrow) break;
}
-
+ }
+ }
bool MadeChange = false;
for (unsigned i = 0, e = SCC.size(); i != e; ++i) {
More information about the llvm-commits
mailing list