[LLVMdev] Will it be slow much if a lot of BasicBlock been created?
t.p.northover at gmail.com
Mon Sep 30 00:38:35 PDT 2013
> Will it be slow too much than before OR make no difference?
It's likely to have significant impact.
> What is BasicBlock treated as in llvm? Just an address of bitcode or a kind
> of structure which contained some informations?
It's got structure. Each basic block has to end with an explicit
branching instruction to its followers ("br i1 %nextLabel" in your
case, by the looks of it), and many optimisation passes may well stop
at their boundaries.
The backend also does virtually all of its instruction-selection at a
purely basic-block level; very few IR-level instructions will be
combined into a single target-instruction if they occur in different
Finally, alloca instructions are only well-optimised if they occur in
the first basic-block of a function. This optimisation (mem2reg) is
key to making many others effective, even if they are willing to look
beyond a single basic-block.
That said, there are passes which recombine basic-blocks. If you only
want to separate them for the convenience of implementing your own
pass then you may be able to avoid most of these bad effects by
running appropriate cleanup passes afterwards that undo it.
More information about the llvm-dev