[llvm-commits] [llvm] r90581 - /llvm/trunk/lib/VMCore/AsmWriter.cpp
Victor Hernandez
vhernandez at apple.com
Fri Dec 4 12:07:11 PST 2009
Author: hernande
Date: Fri Dec 4 14:07:10 2009
New Revision: 90581
URL: http://llvm.org/viewvc/llvm-project?rev=90581&view=rev
Log:
Avoid creating a metadata slot for all metadata that contains an instruction
Modified:
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=90581&r1=90580&r2=90581&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Fri Dec 4 14:07:10 2009
@@ -695,13 +695,8 @@
!I->hasName())
CreateFunctionSlot(I);
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
- if (MDNode *N = dyn_cast_or_null<MDNode>(I->getOperand(i))) {
- // Create a metadata slot only if N contains no instructions.
- for (unsigned n = 0, e = N->getNumElements(); n != e; ++n)
- if (N->getElement(n) && isa<Instruction>(N->getElement(n)))
- continue;
+ if (MDNode *N = dyn_cast_or_null<MDNode>(I->getOperand(i)))
CreateMetadataSlot(N);
- }
// Process metadata attached with this instruction.
MDs.clear();
@@ -818,6 +813,11 @@
void SlotTracker::CreateMetadataSlot(const MDNode *N) {
assert(N && "Can't insert a null Value into SlotTracker!");
+ // Don't insert if N contains an instruction.
+ for (unsigned i = 0, e = N->getNumElements(); i != e; ++i)
+ if (N->getElement(i) && isa<Instruction>(N->getElement(i)))
+ return;
+
ValueMap::iterator I = mdnMap.find(N);
if (I != mdnMap.end())
return;
More information about the llvm-commits
mailing list