diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2009-08-15 20:12:18 +0000 |
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2009-08-15 20:12:18 +0000 |
| commit | dd0e74ceeef9d2b5feca75e2bb46b0d4b86f406a (patch) | |
| tree | 9cb4fcb813f633041fe2d6a0f042b84eea141f0d /llvm/lib/Transforms/Utils | |
| parent | 4c1b9b02c555d002205f2f95b9c2706442944c53 (diff) | |
| download | bcm5719-llvm-dd0e74ceeef9d2b5feca75e2bb46b0d4b86f406a.tar.gz bcm5719-llvm-dd0e74ceeef9d2b5feca75e2bb46b0d4b86f406a.zip | |
SSI construction should just go ahead and ignore instructions in unreachable
blocks.
llvm-svn: 79132
Diffstat (limited to 'llvm/lib/Transforms/Utils')
| -rw-r--r-- | llvm/lib/Transforms/Utils/SSI.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/SSI.cpp b/llvm/lib/Transforms/Utils/SSI.cpp index 63ca3547935..7736f087684 100644 --- a/llvm/lib/Transforms/Utils/SSI.cpp +++ b/llvm/lib/Transforms/Utils/SSI.cpp @@ -39,7 +39,7 @@ STATISTIC(NumPhiInserted, "Number of phi functions inserted"); void SSI::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<DominanceFrontier>(); AU.addRequired<DominatorTree>(); - AU.setPreservesAll(); + AU.setPreservesCFG(); } bool SSI::runOnFunction(Function &F) { @@ -121,7 +121,7 @@ void SSI::insertPhiFunctions(SmallVectorImpl<Instruction *> &value) { // Test if there were any sigmas for this variable if (needConstruction[i]) { - SmallPtrSet<BasicBlock *, 1> BB_visited; + SmallPtrSet<BasicBlock *, 16> BB_visited; // Insert phi functions if there is any sigma function while (!defsites[i].empty()) { @@ -131,6 +131,10 @@ void SSI::insertPhiFunctions(SmallVectorImpl<Instruction *> &value) { defsites[i].pop_back(); DominanceFrontier::iterator DF_BB = DF->find(BB); + // The BB is unreachable. Skip it. + if (DF_BB == DF->end()) + continue; + // Iterates through all the dominance frontier of BB for (std::set<BasicBlock *>::iterator DF_BB_begin = DF_BB->second.begin(), DF_BB_end = DF_BB->second.end(); |

