aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-08-15 20:12:18 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-08-15 20:12:18 +0000
commit071d84e1094e532ea7313c7e7a2c1f106f1d424c (patch)
treeaca6cbecc7126b935424782959329aa8191c9fcd /lib/Transforms/Utils
parentbf230bf5ccd073c85b7a19dcf899031415171cec (diff)
downloadexternal_llvm-071d84e1094e532ea7313c7e7a2c1f106f1d424c.zip
external_llvm-071d84e1094e532ea7313c7e7a2c1f106f1d424c.tar.gz
external_llvm-071d84e1094e532ea7313c7e7a2c1f106f1d424c.tar.bz2
SSI construction should just go ahead and ignore instructions in unreachable
blocks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79132 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r--lib/Transforms/Utils/SSI.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/SSI.cpp b/lib/Transforms/Utils/SSI.cpp
index 63ca354..7736f08 100644
--- a/lib/Transforms/Utils/SSI.cpp
+++ b/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();