[LLVMdev] Assert in llvm-2.7
aparna kotha
kotha.aparna at gmail.com
Thu Jul 22 14:36:29 PDT 2010
Hi All,
We have this piece of code in our system , where we are iteratively remove
functions that we scan the cfg and mark as unreachable.
We observe that with llvm-2.6 func->eraseFromParent() works but with
llvm-2.7 we get a the following assert.
An asserting value handle still pointed to this value!
UNREACHABLE executed at llvm-2.7/lib/VMCore/Value.cpp:522!
CODE
-----------------------------------------------------------------------------------------------------------------------------------------------
for (uriter = unreachables.begin(); uriter != unreachables.end(); uriter++)
{
Function* func = *uriter;
// make sure that the use is within one of the functions
// we're going to remove.
for (Value::use_iterator iter = func->use_begin(); iter !=
func->use_end(); iter++)
{
CallInst* pCall = dyn_cast<CallInst>(*iter);
assert(pCall != NULL);
Function* callerFunc = pCall->getParent()->getParent();
assert(unreachables.find(callerFunc) != unreachables.end());
}
func->replaceAllUsesWith(UndefValue::get(func->getType()));
//checkValueHandles(func);
#ifdef LLVM_VER_2_6
func->eraseFromParent();
#else
func->removeFromParent();
#endif
}
---------------------------------------------------------------------------------------------------------------------------------------------------
We are unable to figure out why we see this. Any pointers would be great.
Aparna
Graduate Student , ECE
University of Maryland, College Park
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100722/81d16b69/attachment.html>
More information about the llvm-dev
mailing list