Hi All, <br><br>We have this piece of code in our system , where we are
iteratively remove functions that were unreachable in the cfg. <br><br>In llvm-2.6 <span style="color: rgb(0, 153, 0);">func->eraseFromParent()</span> worked but now we want to move to llvm-2.7 we get a the following assert. <br>
<br>An asserting value handle still pointed to this value!<br>UNREACHABLE executed at llvm-2.7/lib/VMCore/Value.cpp:<div id=":pu">522!<br><br>CODE<br>-----------------------------------------------------------------------------------------------------------------------------------------------<br>
for (uriter = unreachables.begin(); uriter != unreachables.end(); uriter++)<br> {<br> Function* func = *uriter;<br><br> // make sure that the use is within one of the functions<br> // we're going to remove.<br>
<br> for (Value::<span class="il">use_iterator</span> iter = func->use_begin(); iter != func->use_end(); iter++)<br> {<br> CallInst* pCall = dyn_cast<CallInst>(*iter);<br> assert(pCall != NULL);<br>
Function* callerFunc = pCall->getParent()->getParent();<br> assert(unreachables.find(callerFunc) != unreachables.end());<br> }<br> func->replaceAllUsesWith(UndefValue::get(func->getType()));<br>
<br> func->eraseFromParent();<br> <br> }<br>---------------------------------------------------------------------------------------------------------------------------------------------------<br>
<br><br>I am unable to figure out why we see this. Any pointers would be great. <br><br><br><br><br>Aparna <br><br>Graduate Student , ECE<br>University of Maryland, College Park <br><br></div>