diff options
author | Gabor Greif <ggreif@gmail.com> | 2009-02-09 15:45:06 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2009-02-09 15:45:06 +0000 |
commit | ccd27fb84b0ac13ad1d30b17cbeb87a0ea934154 (patch) | |
tree | ddb8cf871cdd2e5ff04974a0cbccbfb43578e81e /include | |
parent | fb3e5ca53b412a41d26bb4316f10e68aa72f65f6 (diff) | |
download | external_llvm-ccd27fb84b0ac13ad1d30b17cbeb87a0ea934154.zip external_llvm-ccd27fb84b0ac13ad1d30b17cbeb87a0ea934154.tar.gz external_llvm-ccd27fb84b0ac13ad1d30b17cbeb87a0ea934154.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64142 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Instructions.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index fbf376a..d8ce835 100644 --- a/include/llvm/Instructions.h +++ b/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) { |