[llvm-commits] CVS: llvm/lib/Transforms/Utils/LCSSA.cpp

Chris Lattner sabre at nondot.org
Tue Oct 31 09:52:32 PST 2006



Changes in directory llvm/lib/Transforms/Utils:

LCSSA.cpp updated: 1.28 -> 1.29
---
Log message:

Fix PR977: http://llvm.org/PR977  and Transforms/LCSSA/2006-10-31-UnreachableBlock.ll


---
Diffs of the changes:  (+8 -1)

 LCSSA.cpp |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Utils/LCSSA.cpp
diff -u llvm/lib/Transforms/Utils/LCSSA.cpp:1.28 llvm/lib/Transforms/Utils/LCSSA.cpp:1.29
--- llvm/lib/Transforms/Utils/LCSSA.cpp:1.28	Sun Aug 27 17:42:52 2006
+++ llvm/lib/Transforms/Utils/LCSSA.cpp	Tue Oct 31 11:52:18 2006
@@ -184,7 +184,14 @@
     
     // 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.






More information about the llvm-commits mailing list