Add an option to enable the SSA based peephole optimizer.
[oota-llvm.git] / lib / VMCore / ConstantRange.cpp
index b7ef5e05110343674f9d3a8a73ee61a9af8000df..e180f12a1a045f2b7fa14fa731c90bc8d266e081 100644 (file)
@@ -1,4 +1,11 @@
 //===-- ConstantRange.cpp - ConstantRange implementation ------------------===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
 //
 // Represent a range of possible values that may occur when the program is run
 // for an integral value.  This keeps track of a lower and upper bound for the
@@ -19,6 +26,8 @@
 #include "llvm/Instruction.h"
 #include "llvm/ConstantHandling.h"
 
+namespace llvm {
+
 /// Initialize a full (the default) or empty set for the specified type.
 ///
 ConstantRange::ConstantRange(const Type *Ty, bool Full) {
@@ -126,10 +135,7 @@ uint64_t ConstantRange::getSetSize() const {
   // Simply subtract the bounds...
   Constant *Result = *(Constant*)Upper - *(Constant*)Lower;
   assert(Result && "Subtraction of constant integers not implemented?");
-  if (getType()->isSigned())
-    return (uint64_t)cast<ConstantSInt>(Result)->getValue();
-  else
-    return cast<ConstantUInt>(Result)->getValue();
+  return cast<ConstantInt>(Result)->getRawValue();
 }
 
 
@@ -244,3 +250,5 @@ void ConstantRange::print(std::ostream &OS) const {
 void ConstantRange::dump() const {
   print(std::cerr);
 }
+
+} // End llvm namespace