diff options
author | Chris Lattner <sabre@nondot.org> | 2003-08-31 21:17:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-08-31 21:17:44 +0000 |
commit | 1c884e18e1d0d266282ef24c40608b27beb5b8eb (patch) | |
tree | ddc387aac261f16e6333f3d1d80134c2372cb527 /llvm/lib/Transforms/Scalar/TailDuplication.cpp | |
parent | a406dd4bbcd2304892c27eded62e3443f6722dc5 (diff) | |
download | bcm5719-llvm-1c884e18e1d0d266282ef24c40608b27beb5b8eb.tar.gz bcm5719-llvm-1c884e18e1d0d266282ef24c40608b27beb5b8eb.zip |
Fix bug: TailDuplicate/2003-08-31-UnreachableBlocks.ll
llvm-svn: 8276
Diffstat (limited to 'llvm/lib/Transforms/Scalar/TailDuplication.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/TailDuplication.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/TailDuplication.cpp b/llvm/lib/Transforms/Scalar/TailDuplication.cpp index 9427fc664ad..688119805ac 100644 --- a/llvm/lib/Transforms/Scalar/TailDuplication.cpp +++ b/llvm/lib/Transforms/Scalar/TailDuplication.cpp @@ -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 @@ Value *TailDup::GetValueInBlock(BasicBlock *BB, Value *OrigVal, 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 |