[LLVMdev] How to delete a instruction?
noviceup at gmail.com
Tue Apr 20 04:59:53 PDT 2010
when I delete some instruction, I got some error prompt message.
- %i.0.reg2mem.0 = phi i32 [ 0, %bb5 ], [ %indvar.next, %bb12 ] ; <i32>
- %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>
- %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
With Best Regards!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev