[LLVMdev] How to delete a instruction?

lucefe noviceup at gmail.com
Tue Apr 20 04:59:53 PDT 2010


Hi,

when I delete some instruction, I got some error prompt message.

-  %i.0.reg2mem.0 = phi i32 [ 0, %bb5 ], [ %indvar.next, %bb12 ] ; <i32>
[#uses=2]
-  %s.0.reg2mem.0 = phi i32 [ 0, %bb5 ], [ %tmp16, %bb12 ] ; <i32> [#uses=1]
-  %tmp14 = tail call i32 @foobar(i32 %i.0.reg2mem.0) nounwind ; <i32>
[#uses=1]
-  %tmp16 = add i32 %tmp14, %s.0.reg2mem.0         ; <i32> [#uses=2]
   %indvar.next = add i32 %i.0.reg2mem.0, 1        ; <i32> [#uses=2]
   %exitcond = icmp eq i32 %indvar.next, %n        ; <i1> [#uses=1]
   br i1 %exitcond, label %bb25, label %bb12

For example, I want to delete the instructions above with symbol '-' in
front, but when I delete the first one, I got the next prompt message:

While deleting: i32 %s.0.reg2mem.0
Use still stuck around after Def is destroyed:  %tmp16 = add i32 %tmp14,
%s.0.reg2mem.0         ; <i32> [#uses=1]
opt: Value.cpp:81: virtual llvm::Value::~Value(): Assertion `use_empty() &&
"Uses remain when a value is destroyed!"' failed.

Program received signal SIGABRT, Aborted.

I know I should do some work before the deletion to guarantee that no other
instructions will use the instruction being deleted. Who can tell me what I
should do?

With Best Regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100420/3ca43f3a/attachment.html>


More information about the llvm-dev mailing list