[LLVMdev] Hit assert(I != ValueMap.end() && "Value not in slotcalculator!") in ValueEnumerator.cpp
Guoliang Jin
jingl1345 at gmail.com
Wed Sep 22 00:28:26 PDT 2010
Hi there,
I added a function to a module, but failed to write the bitcode to file
because it hit the:
assert(I != ValueMap.end() && "Value not in slotcalculator!")
So I added some diagnosis information there,
unsigned ValueEnumerator::getValueID(const Value *V) const {
if (isa<MDNode>(V) || isa<MDString>(V)) {
ValueMapType::const_iterator I = MDValueMap.find(V);
assert(I != MDValueMap.end() && "Value not in slotcalculator!");
return I->second-1;
}
ValueMapType::const_iterator I = ValueMap.find(V);
if (!(I != ValueMap.end() && "Value not in slotcalculator!")) {
V->dump();
for (ValueMapType::const_iterator IB = ValueMap.begin(), IE =
ValueMap.end();
IB != IE; IB++) {
(*IB).first->dump(); errs() << (*IB).second << " " << V << " " <<
(*IB).first << "\n";
}
assert(I != ValueMap.end() && "Value not in slotcalculator!"); //
this is where the assertion fails
}
return I->second-1;
}
The output show me that the V that it complains is not the ValueMap, but
the content of *V is in the ValueMap.
This happened when I applied my pass to some modules from .cpp, and my
pass worked on some modules from .c files.
Any hint on this?
Thanks,
Guoliang
More information about the llvm-dev
mailing list