<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Thanks, but I replaceAllUsesWith() - works well, but I still get bug in eraseFromParent():</div><div><br></div><div><div><span class="Apple-tab-span" style="white-space: pre; ">  </span>While deleting: i32 (%class.B*, i32)* %_ZN1B1xEi</div><div><span class="Apple-tab-span" style="white-space: pre; ">  </span>An asserting value handle still pointed to this value!</div><div><span class="Apple-tab-span" style="white-space: pre; ">    </span>UNREACHABLE executed at /Users/neonomaly/LLVM/LLVM/lib/VMCore/Value.cpp:561!</div></div><div><br></div><br><div apple-content-edited="true"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div></div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Yours sincerely,</div><div>Kadysev Mikhail</div></div></span></div></div><br><div><div>21.04.2012, Χ 23:45, Nick Lewycky ΞΑΠΙΣΑΜ(Α):</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>νΙΘΑΙΜ wrote:<br><blockquote type="cite">How correctly remove function from module?<br></blockquote><blockquote type="cite">For example:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">int f1(int x) {<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite">a = f2(smth);<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite">}<br></blockquote><blockquote type="cite">int f2 (int y) {<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite">b = f1(smth);<br></blockquote><blockquote type="cite">...<br></blockquote><blockquote type="cite">}<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I need delete from module both f1 and f2. They haven't uses in other<br></blockquote><blockquote type="cite">part of module, but I can't delete them with eraseFromParent, because<br></blockquote><blockquote type="cite">they are use each other.<br></blockquote><br>Call X->replaceAllUsesWith(UndefValue::get(X->getType)) before calling X->eraseFromParent().<br><br>Nick<br></div></blockquote></div><div><div><br></div></div><div></div></body></html>