[llvm-commits] [PATCH] SuccIterator on bbs without terminator insts

Nick Lewycky nicholas at mxc.ca
Sun Jul 3 17:17:43 PDT 2011


Tobias Grosser wrote:
> Hi,
>
> this patch removes the assert, that triggers if SuccIterator is
> constructed for a basic block without a terminator instruction. Instead
> of triggering an assert a succ_end() iterator is returned. This models a
> basic block with zero successors and allows us to use F->viewCFG() on
> incompletely constructed functions.
>
> OK to commit?

Intuitively no, because all basic blocks are required to have 
terminators. But I suspect you ran into this for a reason, and tools 
like succ_begin/end() may not be able to assume that the CFG is valid at 
any point in time because the IR is being modified. Could you explain 
more about what you were doing which triggered this? Would it be 
difficult to avoid calling succ_begin() on malformed basic blocks?

Nick



More information about the llvm-commits mailing list