- Renamed Type::isIntegral() to Type::isInteger()
  - Added new method Type::isIntegral() that is the same as isInteger, but
    also accepts bool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3574 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
index 5004d90..870bbbd 100644
--- a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
+++ b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
@@ -72,12 +72,12 @@
   isValidConstant = true;
 
   if (isa<Constant>(V))
-    if (V->getType() == Type::BoolTy)
-      return (int64_t) cast<ConstantBool>(V)->getValue();
-    else if (V->getType()->isIntegral())
-      return (V->getType()->isUnsigned()
-              ? cast<ConstantUInt>(V)->getValue()
-              : (uint64_t) cast<ConstantSInt>(V)->getValue());
+    if (const ConstantBool *CB = dyn_cast<ConstantBool>(V))
+      return (int64_t)CB->getValue();
+    else if (const ConstantSInt *CS = dyn_cast<ConstantSInt>(V))
+      return (uint64_t)CS->getValue();
+    else if (const ConstantUInt *CU = dyn_cast<ConstantUInt>(V))
+      return CU->getValue();
 
   isValidConstant = false;
   return 0;
@@ -343,7 +343,7 @@
     }
   
   // Otherwise it needs to be an integer or a NULL pointer
-  if (! CPV->getType()->isIntegral() &&
+  if (! CPV->getType()->isInteger() &&
       ! (isa<PointerType>(CPV->getType()) &&
          CPV->isNullValue()))
     return opType;