[LLVMdev] redundant checking of terminator in Verifier?
Chris Lattner
clattner at apple.com
Fri Jun 25 09:32:24 PDT 2010
On Jun 25, 2010, at 8:47 AM, Jianzhou Zhao wrote:
> 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
>
> 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
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list