[llvm-commits] CVS: llvm/lib/Transforms/Scalar/TailDuplication.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Aug 31 16:18:01 PDT 2003


Changes in directory llvm/lib/Transforms/Scalar:

TailDuplication.cpp updated: 1.7 -> 1.8

---
Log message:

Fix bug: TailDuplicate/2003-08-31-UnreachableBlocks.ll


---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/TailDuplication.cpp
diff -u llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.7 llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.8
--- llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.7	Sat Aug 23 15:08:30 2003
+++ llvm/lib/Transforms/Scalar/TailDuplication.cpp	Sun Aug 31 16:17:44 2003
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/Scalar.h"
+#include "llvm/Constant.h"
 #include "llvm/Function.h"
 #include "llvm/iPHINode.h"
 #include "llvm/iTerminators.h"
@@ -268,8 +269,10 @@
   ValueHolder &BBVal = ValueMap[BB];
   if (BBVal) return BBVal;       // Value already computed for this block?
 
-  assert(pred_begin(BB) != pred_end(BB) &&
-         "Propagating PHI nodes to unreachable blocks?");
+  // If this block has no predecessors, then it must be unreachable, thus, it
+  // doesn't matter which value we use.
+  if (pred_begin(BB) == pred_end(BB))
+    return BBVal = Constant::getNullValue(OrigVal->getType());
 
   // If there is no value already available in this basic block, we need to
   // either reuse a value from an incoming, dominating, basic block, or we need





More information about the llvm-commits mailing list