error: terminator in the middle of basic block

I modified the PathProfiling.cpp and run opt -inesrt-path-profiling. it
works correctly ,but after path-profile is complete in
Verifier::visitTerminatorInst it prints "Terminator found in the middle
of a basic block!" .
error is I added two basic blocks after return basic block and return has
br label %newprint when printed in pathprofile module

but in Verifier::visitTerminatorInst
I=br label %newprint and I.getParent()->getTerminator= <null>

when I printed pathprofile mode return had terminator br label %newprint.

what is the reason?

unnikrishnan c

It's almost impossible to tell with only a verbal description, but my bet is that the branch is not the last instruction in the basic block. A terminator must be last.