<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 26, 2011, at 1:42 PM, Tanya Lattner wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 26, 2011, at 12:18 PM, ret val wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>I made a GlobalVariable that is of type ConstantArray. For one of it's<br>elements I assigned it the ConstantExpr::getBitCast of another<br>GlobalVariable(the "shadow pointer" mentioned). This gives me:<br><br> While deleting: i32 (i32)** %Shadow Variable for ptr1<br> Use still stuck around after Def is destroyed:i8* bitcast (i32<br>(i32)** @"Shadow Variable for ptr1" to i8*)<br> opt: Value.cpp:75: virtual llvm::Value::~Value(): Assertion<br>`use_empty() && "Uses remain when a value is destroyed!"' failed.<br><br>I only see this after my Pass' runOnModule() method is done. I'm not<br>sure what I'm doing wrong, this seems like a legitimate actions. I<br>also cant come up with another way to do this.<br><br></div></blockquote><div><br></div><div>Are you saying that a dead ConstantExpr that uses the Global is hanging around when you try to delete it?</div><div><br></div><div>If so, use <span class="Apple-style-span" style="white-space: pre-wrap; ">removeDeadUsersOfConstant() on the Global before you try to remove it.</span></div><div><span class="Apple-style-span" style="white-space: pre-wrap; "><br></span></div></div></div></blockquote><div><br></div><div>Sorry, I mean </div><table class="memname" style="font-family: Times; "><tbody><tr><td class="memname">removeDeadConstantUsers</td><td>(</td><td class="paramname"></td><td> )</td></tr></tbody></table><div><br></div><div>-Tanya</div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><span class="Apple-style-span" style="white-space: pre-wrap; ">If the use is not dead, then you can't remove the GlobalVar.</span></div><div><span class="Apple-style-span" style="font-family: monospace; white-space: pre-wrap; "><br></span></div><div><span class="Apple-style-span" style="white-space: pre-wrap; "><font class="Apple-style-span" size="2">-Tanya</font></span></div><br><blockquote type="cite"><div>Any advice?<br>Thank you<br>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu/">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></div></blockquote></div><br></div></blockquote></div><br></body></html>