summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2009-02-09 15:45:06 +0000
committerGabor Greif <ggreif@gmail.com>2009-02-09 15:45:06 +0000
commitcab008f51f01236c930df25beb2b4a3460580fda (patch)
treec27397c030e242738a9a9701d3b14c3f1bcb3e61 /llvm/include
parent9817f4a71764543bfd683773bedbe20c3cb68d2b (diff)
downloadbcm5719-llvm-cab008f51f01236c930df25beb2b4a3460580fda.tar.gz
bcm5719-llvm-cab008f51f01236c930df25beb2b4a3460580fda.zip
make sure that BranchInst::getSuccessor() does not assert in cast<>
even if the underlying operand is NULL. This may happen in debugging context within opt with partial loop unrolling (see test/Transforms/LoopUnroll/partial.ll). After this fix I can resubmit the (backed out) r63459: * lib/VMCore/AsmWriter.cpp: use precise accessors. llvm-svn: 64142
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Instructions.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/include/llvm/Instructions.h b/llvm/include/llvm/Instructions.h
index fbf376afd5d..d8ce835d790 100644
--- a/llvm/include/llvm/Instructions.h
+++ b/llvm/include/llvm/Instructions.h
@@ -2186,7 +2186,9 @@ public:
BasicBlock *getSuccessor(unsigned i) const {
assert(i < getNumSuccessors() && "Successor # out of range for Branch!");
- return cast<BasicBlock>(getOperand(i));
+ if (Value *V = getOperand(i))
+ return cast<BasicBlock>(V);
+ return 0;
}
void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
OpenPOWER on IntegriCloud