Hi All, <br><br>We have this piece of code in our system , where we are iteratively remove functions that we scan the cfg and mark as unreachable. <br>We observe that with llvm-2.6 func->eraseFromParent() works but with 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: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::use_iterator 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>        //checkValueHandles(func);<br>#ifdef LLVM_VER_2_6<br>        func->eraseFromParent();<br>#else<br>        func->removeFromParent();<br>#endif<br>       <br>    }<br>---------------------------------------------------------------------------------------------------------------------------------------------------<br>
<br><br>We are 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><br>