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 | cab008f51f01236c930df25beb2b4a3460580fda (patch) | |
| tree | c27397c030e242738a9a9701d3b14c3f1bcb3e61 /llvm/lib | |
| parent | 9817f4a71764543bfd683773bedbe20c3cb68d2b (diff) | |
| download | bcm5719-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/lib')
| -rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 6a17516be26..0322d669d32 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -1505,13 +1505,14 @@ void AssemblyWriter::printInstruction(const Instruction &I) { const Value *Operand = I.getNumOperands() ? I.getOperand(0) : 0; // Special case conditional branches to swizzle the condition out to the front - if (isa<BranchInst>(I) && I.getNumOperands() > 1) { + if (isa<BranchInst>(I) && cast<BranchInst>(I).isConditional()) { + BranchInst &BI(cast<BranchInst>(I)); Out << ' '; - writeOperand(I.getOperand(2), true); + writeOperand(BI.getCondition(), true); Out << ", "; - writeOperand(Operand, true); + writeOperand(BI.getSuccessor(0), true); Out << ", "; - writeOperand(I.getOperand(1), true); + writeOperand(BI.getSuccessor(1), true); } else if (isa<SwitchInst>(I)) { // Special case switch statement to get formatting nice and correct... |

