summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/Utils/LCSSA.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp
index 6f93ac6fce..b369a738dc 100644
--- a/lib/Transforms/Utils/LCSSA.cpp
+++ b/lib/Transforms/Utils/LCSSA.cpp
@@ -184,7 +184,14 @@ void LCSSA::ProcessInstruction(Instruction *Instr,
// Otherwise, patch up uses of the value with the appropriate LCSSA Phi,
// inserting PHI nodes into join points where needed.
- Value *Val = GetValueForBlock(DT->getNode(UserBB), Instr, Phis);
+ DominatorTree::Node *UserBBNode = DT->getNode(UserBB);
+
+ // If the block has no dominator info, it is unreachable.
+ Value *Val;
+ if (UserBBNode)
+ Val = GetValueForBlock(UserBBNode, Instr, Phis);
+ else
+ Val = UndefValue::get(Instr->getType());
// Preincrement the iterator to avoid invalidating it when we change the
// value.