How to interrupt PassManager optimizations flow?

Hi,

I have PassManager object storing module optimizations. One of the optimizations performs analysis which basically checks the code for being “valid”. If code is not “valid” we should break optimizations flow in PassManager and report error.

Does PassManager support interrupting flow of optimizations if one of optimizations raise “stop” flag?

Thanks,

-Oleg