[llvm-commits] CVS: llvm/lib/Bitcode/Writer/ValueEnumerator.cpp ValueEnumerator.h
Chris Lattner
sabre at nondot.org
Sun May 6 01:35:40 PDT 2007
Changes in directory llvm/lib/Bitcode/Writer:
ValueEnumerator.cpp updated: 1.13 -> 1.14
ValueEnumerator.h updated: 1.10 -> 1.11
---
Log message:
Fix a nasty problem where we would miss enumeration of some types. This fixes
issues with CE_CAST etc.
---
Diffs of the changes: (+18 -1)
ValueEnumerator.cpp | 18 +++++++++++++++++-
ValueEnumerator.h | 1 +
2 files changed, 18 insertions(+), 1 deletion(-)
Index: llvm/lib/Bitcode/Writer/ValueEnumerator.cpp
diff -u llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.13 llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.14
--- llvm/lib/Bitcode/Writer/ValueEnumerator.cpp:1.13 Sat May 5 20:00:28 2007
+++ llvm/lib/Bitcode/Writer/ValueEnumerator.cpp Sun May 6 03:35:19 2007
@@ -84,7 +84,7 @@
for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E;++I){
for (User::const_op_iterator OI = I->op_begin(), E = I->op_end();
OI != E; ++OI)
- EnumerateType((*OI)->getType());
+ EnumerateOperandType(*OI);
EnumerateType(I->getType());
}
}
@@ -226,6 +226,22 @@
EnumerateParamAttrs(FTy->getParamAttrs());
}
+// Enumerate the types for the specified value. If the value is a constant,
+// walk through it, enumerating the types of the constant.
+void ValueEnumerator::EnumerateOperandType(const Value *V) {
+ EnumerateType(V->getType());
+ if (const Constant *C = dyn_cast<Constant>(V)) {
+ // If this constant is already enumerated, ignore it, we know its type must
+ // be enumerated.
+ if (ValueMap.count(V)) return;
+
+ // This constant may have operands, make sure to enumerate the types in
+ // them.
+ for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i)
+ EnumerateOperandType(C->getOperand(i));
+ }
+}
+
void ValueEnumerator::EnumerateParamAttrs(const ParamAttrsList *PAL) {
if (PAL == 0) return; // null is always 0.
// Do a lookup.
Index: llvm/lib/Bitcode/Writer/ValueEnumerator.h
diff -u llvm/lib/Bitcode/Writer/ValueEnumerator.h:1.10 llvm/lib/Bitcode/Writer/ValueEnumerator.h:1.11
--- llvm/lib/Bitcode/Writer/ValueEnumerator.h:1.10 Fri May 4 00:21:47 2007
+++ llvm/lib/Bitcode/Writer/ValueEnumerator.h Sun May 6 03:35:19 2007
@@ -114,6 +114,7 @@
void EnumerateValue(const Value *V);
void EnumerateType(const Type *T);
+ void EnumerateOperandType(const Value *V);
void EnumerateParamAttrs(const ParamAttrsList *PAL);
void EnumerateTypeSymbolTable(const TypeSymbolTable &ST);
More information about the llvm-commits
mailing list