redundant checking of terminator in Verifier?

Hi,

The checking about that if this is a terminator that it is at the end
of the block has been applied twice (bellow). One is at
Verifier::visitInstruction, and the other is at
Verifier::visitTerminatorInst. Since visitInstruction is called when
visiting each instruction, the checking at visitTerminatorInst seems
redundant to me. Did I miss any case?

void Verifier::visitInstruction(Instruction &I) {
...
line 1356:
  // Verify that if this is a terminator that it is at the end of the block.
  if (isa<TerminatorInst>(I))
    Assert1(BB->getTerminator() == &I, "Terminator not at end of block!", &I);
...
}

void Verifier::visitTerminatorInst(TerminatorInst &I) {
  // Ensure that terminators only exist at the end of the basic block.
  Assert1(&I == I.getParent()->getTerminator(),
          "Terminator found in the middle of a basic block!", I.getParent());
  visitInstruction(I);
}

Hi,

The checking about that if this is a terminator that it is at the end
of the block has been applied twice (bellow). One is at
Verifier::visitInstruction, and the other is at
Verifier::visitTerminatorInst. Since visitInstruction is called when
visiting each instruction, the checking at visitTerminatorInst seems
redundant to me. Did I miss any case?

These are checking two subtly different things. The first one is checking that there isn't a terminator in the middle of the block, the second is checking that there is a terminator at the end of a block.

-Chris