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

John Criswell criswell at illinois.edu
Tue Aug 26 13:04:16 PDT 2014


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 
> <mailto: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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140826/ab129631/attachment.html>


More information about the llvm-dev mailing list