Function-local metadata whose operands had been optimized to no longer refer to function-local IR were not getting written by BitcodeWriter; solution is for these metadata to be enumerated just like global metadata.

llvm-svn: 95467
This commit is contained in:
Victor Hernandez
2010-02-06 01:21:09 +00:00
parent 74bb06c0f0
commit 1b08138152
2 changed files with 27 additions and 2 deletions

View File

@@ -93,7 +93,7 @@ ValueEnumerator::ValueEnumerator(const Module *M) {
for (User::const_op_iterator OI = I->op_begin(), E = I->op_end();
OI != E; ++OI) {
if (MDNode *MD = dyn_cast<MDNode>(*OI))
if (MD->isFunctionLocal())
if (MD->isFunctionLocal() && MD->getFunction())
// These will get enumerated during function-incorporation.
continue;
EnumerateOperandType(*OI);
@@ -415,7 +415,7 @@ void ValueEnumerator::incorporateFunction(const Function &F) {
for (User::const_op_iterator OI = I->op_begin(), E = I->op_end();
OI != E; ++OI) {
if (MDNode *MD = dyn_cast<MDNode>(*OI))
if (MD->isFunctionLocal())
if (MD->isFunctionLocal() && MD->getFunction())
// Enumerate metadata after the instructions they might refer to.
FunctionLocalMDs.push_back(MD);
}