[LLVMdev] redundant checking of terminator in Verifier?

Jianzhou Zhao jianzhou at seas.upenn.edu
Fri Jun 25 08:47:03 PDT 2010


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);
}

-- 
Jianzhou



More information about the llvm-dev mailing list