Hi All, We have this piece of code in our system , where we are iteratively remove functions that were unreachable in the cfg. In llvm-2.6 func->eraseFromParent() worked but now we want to move to 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())); func->eraseFromParent(); } --------------------------------------------------------------------------------------------------------------------------------------------------- I am 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/20100915/63d44b58/attachment.html>
Hi Aparna,> We have this piece of code in our system , where we are iteratively remove > functions that were unreachable in the cfg. > > In llvm-2.6 func->eraseFromParent() worked but now we want to move to 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!perhaps you need to update the callgraph? Historically, all kinds of passes (such as the inliner) were using the callgraph but not updating it properly when removing calls, leading to subtle miscompilations. Because of this the callgraph was changed to complain loudly when such mistakes are made - IIRC, the symptoms are similar to what you describe. If this is not the reason, I suggest you try to find out which asserting value handle is floating around and who created it - that should give you a clue. Ciao, Duncan.
Seemingly Similar Threads
- [LLVMdev] Assert in llvm-2.7
- [LLVMdev] [LLVMDEV]How could I get function name in this situation?
- [LLVMdev] [LLVMDEV]How could I get function name in this situation?
- [LLVMdev] [LLVMDEV]How could I get function name in this situation?
- [LLVMdev] [LLVMDEV]How could I get function name in this situation?