Convert more code to use new style casts
Eliminate old style casts from value.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@696 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/Expressions.cpp b/lib/Analysis/Expressions.cpp
index 8c9d75f..cb83d41 100644
--- a/lib/Analysis/Expressions.cpp
+++ b/lib/Analysis/Expressions.cpp
@@ -16,14 +16,17 @@
 using namespace analysis;
 
 ExprType::ExprType(Value *Val) {
-  if (Val && Val->isConstant() && Val->getType()->isIntegral()) {
-    Offset = (ConstPoolInt*)Val->castConstant();
-    Var = 0;
-    ExprTy = Constant;
-  } else {
-    Var = Val; Offset = 0;
-    ExprTy = Var ? Linear : Constant;
-  }
+  if (Val) 
+    if (ConstPoolInt *CPI = dyn_cast<ConstPoolInt>(Val)) {
+      Offset = CPI;
+      Var = 0;
+      ExprTy = Constant;
+      Scale = 0;
+      return;
+    }
+
+  Var = Val; Offset = 0;
+  ExprTy = Var ? Linear : Constant;
   Scale = 0;
 }