[LLVMdev] The basic block does not exist in the map

Will Dietz willdtz at gmail.com
Wed Aug 27 09:54:58 PDT 2014


Apologies if I'm missing something, but quick grep's for fragments of
your given error message aren't turning up anything....

Is this error occurring in LLVM or in some other project/code?

After checking that you're indeed adding the BB correctly to the
function (see John's response),
my next best guess is you're using some custom pass and querying stale state.
Either the pass isn't being invalidated when it should or the pass
transforming the IR
(adding the BB, for example) queries the pass before it has a chance
to be invalidated.

If that is the case, you'll need to either fix the invalidation bug or
reorganize your transform/analysis
passes appropriately.  Alternatively, it might be reasonable to add an
update interface to your analysis
pass so the transform can notify the analysis of IR changes,
preserving the validity of the analysis results.
This can be difficult and isn't likely worth the effort (especially
the effort to ensure this is done correctly)
unless your transforms have a simple/easy to reason about impact on
the analysis in question.

Anyway, hope this helps, good luck! :)

~Will

On Tue, Aug 26, 2014 at 3:04 PM, John Criswell <criswell at illinois.edu> wrote:
> Dear Song,
>
> My best guess on the problem is that you're not adding the new basic block C
> to the function when you create it.
>
> The BasicBlock::Create() method allows you to specify a NULL pointers for
> the parent function and for the basic block before which to insert the new
> basic block.  If you specify those, then I think that will alleviate the
> error.
>
> If you're creating basic blocks and not specifying into what function they
> should go or in what order in the basic block list they should be, then you
> might get the error that you're seeing.  There's a way to insert an existing
> basic block into a function, but I don't know off hand what that is.
>
> I hope this helps.  Let us know if it doesn't.
>
> Regards,
>
> John Criswell
>
>
>
> On 8/23/14, 7:06 PM, songy92 at stanford.edu wrote:
>
> Hi All,
> I am new to LLVM and now involved into a problem, would it be possible to
> get some help?
>
> I want to insert a new basic block into a program by writing a pass. For
> example, there are block A and B in the original block where A jumps to B:
> A -> B.
>
> For now I want to insert a block C bewteen them:
> A -> C -> B.
>
> However, if the branch instruction from A to C or from C to B is created, an
> error message occurs:
> bb->getName() = C
>  "The basic block does not exist in the map."=The basic block does not exist
> in the map.
>
> So, how can I add the new block C to the original map?
>
> Thank you very much!
>
> Song
>
>
> ________________________________
> Research Intern in Dept. of Computer Science, Stanford University
> Email: songy92 at stanford.edu, yaosong1992 at gmail.com
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
>
> _______________________________________________
> 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