summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/LCSSA.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-10-31 17:52:18 +0000
committerChris Lattner <sabre@nondot.org>2006-10-31 17:52:18 +0000
commiteb68f080ef2af65d09521816d2202d445ea9586c (patch)
tree227cbc1b963bd6a2c55ad61d5417221f37a83dad /llvm/lib/Transforms/Utils/LCSSA.cpp
parent0f2e89fcf32f58b30a9035711a01341f948abf62 (diff)
downloadbcm5719-llvm-eb68f080ef2af65d09521816d2202d445ea9586c.tar.gz
bcm5719-llvm-eb68f080ef2af65d09521816d2202d445ea9586c.zip
Fix PR977 and Transforms/LCSSA/2006-10-31-UnreachableBlock.ll
llvm-svn: 31315
Diffstat (limited to 'llvm/lib/Transforms/Utils/LCSSA.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LCSSA.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp
index 6f93ac6fcef..b369a738dca 100644
--- a/llvm/lib/Transforms/Utils/LCSSA.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud