aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/SlotCalculator.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-06-27 23:41:11 +0000
committerChris Lattner <sabre@nondot.org>2001-06-27 23:41:11 +0000
commit7fc9fe34390c66ca58646d09a87f7dbaacb6c1f8 (patch)
treefd083cad8506b9f54d19b8429dfae825f264c35b /lib/VMCore/SlotCalculator.cpp
parent138a124f09de272b2ab93cfd6e2a8a283d18029b (diff)
Miscellaneous cleanups:
* Convert post to pre-increment for for loops * Use generic programming more * Use new Value::cast* instructions * Use new Module, Method, & BasicBlock forwarding methods * Use new facilities in STLExtras.h * Use new Instruction::isPHINode() method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/SlotCalculator.cpp')
-rw-r--r--lib/VMCore/SlotCalculator.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/VMCore/SlotCalculator.cpp b/lib/VMCore/SlotCalculator.cpp
index 01fae37e53..f7eada1418 100644
--- a/lib/VMCore/SlotCalculator.cpp
+++ b/lib/VMCore/SlotCalculator.cpp
@@ -176,12 +176,11 @@ void SlotCalculator::insertVal(const Value *D) {
// Insert node into table and NodeMap...
NodeMap[D] = Table[Ty].size();
- if (Typ == Type::TypeTy && // If it's a type constant, add the Type also
- D->getValueType() != Value::TypeVal) {
- assert(D->getValueType() == Value::ConstantVal &&
- "All Type instances should be constant types!");
-
- const ConstPoolType *CPT = (const ConstPoolType*)D;
+ if (Typ == Type::TypeTy && !D->isType()) {
+ // If it's a type constant, add the Type also
+
+ // All Type instances should be constant types!
+ const ConstPoolType *CPT = (const ConstPoolType*)D->castConstantAsserting();
int Slot = getValSlot(CPT->getValue());
if (Slot == -1) {
// Only add if it's not already here!