//
// The LLVM Compiler Infrastructure
//
-// This file was developed by Nick Lewycky and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
++J;
}
- if (J != E && J->To == n && J->Subtree->dominates(Subtree)) {
+ if (J != E && J->To == n) {
edge.LV = static_cast<LatticeVal>(J->LV & R);
assert(validPredicate(edge.LV) && "Invalid union of lattice values.");
- if (edge.LV != J->LV) {
-
- // We have to tighten any edge beneath our update.
- for (iterator K = I; K->To == n; --K) {
- if (K->Subtree->DominatedBy(Subtree)) {
- LatticeVal LV = static_cast<LatticeVal>(K->LV & edge.LV);
- assert(validPredicate(LV) && "Invalid union of lattice values");
- K->LV = LV;
- }
- if (K == B) break;
- }
+ if (edge.LV == J->LV)
+ return; // This update adds nothing new.
+ }
+
+ if (I != B) {
+ // We also have to tighten any edge beneath our update.
+ for (iterator K = I - 1; K->To == n; --K) {
+ if (K->Subtree->DominatedBy(Subtree)) {
+ LatticeVal LV = static_cast<LatticeVal>(K->LV & edge.LV);
+ assert(validPredicate(LV) && "Invalid union of lattice values");
+ K->LV = LV;
+ }
+ if (K == B) break;
}
}
else if (isa<ConstantPointerNull>(V))
return ConstantRange(APInt::getNullValue(typeToWidth(V->getType())));
else
- return typeToWidth(V->getType());
+ return ConstantRange(typeToWidth(V->getType()));
}
// typeToWidth - returns the number of bits necessary to store a value of
uint32_t typeToWidth(const Type *Ty) const {
if (TD)
return TD->getTypeSizeInBits(Ty);
-
- if (const IntegerType *ITy = dyn_cast<IntegerType>(Ty))
- return ITy->getBitWidth();
-
- return 0;
+ else
+ return Ty->getPrimitiveSizeInBits();
}
static bool isRelatedBy(const ConstantRange &CR1, const ConstantRange &CR2,
if (!isRelatedBy(Known, Zero, ICmpInst::ICMP_NE)) break;
// otherwise, fall-through.
case Instruction::Sub:
- if (Unknown == Op1) break;
+ if (Unknown == Op0) break;
// otherwise, fall-through.
case Instruction::Xor:
case Instruction::Add: