I have checked the way it is used in other file, but the problem is
whenever I call CloneBasicBlock, after the block is duplicated it tries
to delete some variables and I dont understand that why it does that.<br><br>I
am just trying to duplicate a single block, and that is giving error. I
really dont understand why does it wants to delete it...<br><br><div class="gmail_quote">On Fri, Jun 4, 2010 at 10:40 PM, Devang Patel <span dir="ltr"><<a href="mailto:devang.patel@gmail.com">devang.patel@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On Fri, Jun 4, 2010 at 2:15 AM, Ambika Agarwal <<a href="mailto:agarwal.ambika@gmail.com">agarwal.ambika@gmail.com</a>> wrote:<br>

> Hi,<br>
><br>
> I had asked earlier from my another ID about duplicating a basic block, but<br>
> that server is down for moment.<br>
> I was given suggestion to use CloneBasicBlock, but when I used it I get an<br>
> error :<br>
><br>
> While deleting: i32* %a<br>
> Use still stuck around after Def is destroyed:  store i32* %a, i32** %p,<br>
> align 4<br>
> opt: /home/ambika/llvm_3/llvm-2.6/lib/VMCore/Value.cpp:81: virtual<br>
> llvm::Value::~Value(): Assertion `use_empty() && "Uses remain when a value<br>
> is destroyed!"' failed.<br>
> 0   opt 0x08471218<br>
> Aborted<br>
><br>
> This message is printed inside destructor of class value  .<br>
> Now I dont understand that after all the instructions are duplicated why<br>
> does thios kind of error come??<br>
><br>
> I will be very thankful if someone can help me.<br>
<br>
</div></div>As the message says, the value being destroyed is used. Check users of<br>
this value. You'll have to update them to use something else before<br>
destroying the value. There is not any magic utility that does<br>
everything. Take a look at how CloneBasicBlock is used other places<br>
and try to update your pass accordingly.<br>
<br>
-<br>
<font color="#888888">Devang<br>
</font></blockquote></div><br>