[LLVMdev] DSGraph::computeCalleeCallerMapping failing
Swarup Kumar Sahoo
ssahoo2 at uiuc.edu
Fri Dec 1 10:51:23 PST 2006
I was trying to call "DSGraph::computeCalleeCallerMapping" function on all caller-calle pair. But, in one case it gives an assertion failure. This is the error message I get.
Processing internal callee function rt_error
opt: /localhome/ssahoo2/llvm/src/lib/Analysis/DataStructure/DataStructure.cpp:2248: static void llvm::DSGraph::computeNodeMapping(const llvm::DSNodeHandle&, const llvm::DSNodeHandle&, __gnu_cxx::hash_map<const llvm::DSNode*, llvm::DSNodeHandle, __gnu_cxx::hash<const llvm::DSNode*>, std::equal_to<const llvm::DSNode*>, std::allocator<llvm::DSNodeHandle> >&, bool): Assertion `Entry.getNode() == N2 && "Inconsistent mapping detected!"' failed.
../../../../../../old_obj/Debug/bin/opt((anonymous namespace)::PrintStackTrace()+0x1a)[0x875282e]
../../../../../../old_obj/Debug/bin/opt((anonymous namespace)::SignalHandler(int)+0xe9)[0x8752abd]
/lib/tls/libc.so.6[0x9fca58]
/lib/tls/libc.so.6(abort+0x1d2)[0x9fe342]
/lib/tls/libc.so.6(__assert_fail+0x108)[0x9f6338]
../../../../../../old_obj/Debug/bin/opt(llvm::DSGraph::computeNodeMapping(llvm::DSNodeHandle const&, llvm::DSNodeHandle const&, __gnu_cxx::hash_map<llvm::DSNode const*, llvm::DSNodeHandle, __gnu_cxx::hash<llvm::DSNode const*>, std::equal_to<llvm::DSNode const*>, std::allocator<llvm::DSNodeHandle> >&, bool)+0xad)[0x848bbab]
../../../../../../old_obj/Debug/bin/opt(llvm::DSGraph::computeCalleeCallerMapping(llvm::DSCallSite, llvm::Function const&, llvm::DSGraph&, __gnu_cxx::hash_map<llvm::DSNode const*, llvm::DSNodeHandle, __gnu_cxx::hash<llvm::DSNode const*>, std::equal_to<llvm::DSNode const*>, std::allocator<llvm::DSNodeHandle> >&)+0x1e1)[0x848c20d]
../../../../../../old_obj/projects/New-Slicing/Debug/lib/program_slicing.so(ipps::MemArgs::runOnSCC(std::vector<llvm::CallGraphNode*, std::allocator<llvm::CallGraphNode*> > const&)+0x3ae)[0x34c01e]
../../../../../../old_obj/Debug/bin/opt(llvm::CallGraphSCCPass::runOnModule(llvm::Module&)+0x9d)[0x86af837]
../../../../../../old_obj/Debug/bin/opt(llvm::ModulePassManager::runPass(llvm::ModulePass*, llvm::Module*)+0x1f)[0x857fe03]
../../../../../../old_obj/Debug/bin/opt(llvm::PassManagerT<llvm::MTraits>::runPasses(llvm::Module*, std::map<llvm::Pass*, std::vector<llvm::Pass*, std::allocator<llvm::Pass*> >, std::less<llvm::Pass*>, std::allocator<std::pair<llvm::Pass* const, std::vector<llvm::Pass*, std::allocator<llvm::Pass*> > > > >&)+0x13e)[0x857ec40]
../../../../../../old_obj/Debug/bin/opt(llvm::PassManagerT<llvm::MTraits>::runOnUnit(llvm::Module*)+0x17b)[0x857eac7]
../../../../../../old_obj/Debug/bin/opt(llvm::ModulePassManager::runOnModule(llvm::Module&)+0x25)[0x850ad95]
../../../../../../old_obj/Debug/bin/opt(llvm::PassManager::run(llvm::Module&)+0x23)[0x850b125]
../../../../../../old_obj/Debug/bin/opt(main+0x8d6)[0x843194a]
/lib/tls/libc.so.6(__libc_start_main+0xf0)[0x9ea770]
../../../../../../old_obj/Debug/bin/opt(std::__throw_logic_error(char const*)+0x5d)[0x8430ee1]
Aborted (core dumped)
My code looks something like this:
TDDataStructures &TDD = getAnalysis<TDDataStructures>();
for(unsigned int i=0;i<SCC.size();i++) // Go through the functions in the SCC
{
Function *fun = SCC[i]->getFunction();
if( fun == NULL || fun->isExternal() )
{ MYWARN( true, "Encountered a null function pointer or external function\n" ); continue; }
// Iterate over the instructions in the function
for( inst_iterator instIt = inst_begin(fun); instIt!=inst_end(fun); instIt++ )
{
if( CallInst *CI = dyn_cast<CallInst>(&*instIt) ) // Check for Call instruction
{
CallSite CS = CallSite(CI);
Function *callee = CI->getCalledFunction ();
if( callee == NULL )
continue;
else if( !callee->isExternal() ) // Internal Function
{
DEBUG( std::cerr<< "Processing internal callee function "<<callee->getName()<<"\n" );
dsgCaller = &TDD.getDSGraph(*fun);
dsgCallee = &TDD.getDSGraph(*callee);
DSCallSite dscs = ( dsgCaller->getDSCallSiteForCallSite(CS) );
dsgCaller->computeCalleeCallerMapping ( dscs, *callee, *dsgCallee, NodeMap);
}
}
}
}
Is there anything wrong the way I am calling "computeCalleeCallerMapping" or any aother mistake I may be doing? Thanks.
Regards,
Swarup.
*************************************
Swarup Kumar Sahoo
Thomas M. Siebel Center for Computer Science
University of Illinois at Urbana Champaign
201 N Goodwin Avenue
Urbana, IL-61801
Phone - 614 264 9574
More information about the llvm-dev
mailing list