]> granicus.if.org Git - llvm/commitdiff
Fix bug: IndVarSimplify/2003-04-16-ExprAnalysis.ll
authorChris Lattner <sabre@nondot.org>
Wed, 16 Apr 2003 22:50:19 +0000 (22:50 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 16 Apr 2003 22:50:19 +0000 (22:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5795 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/Expressions.cpp

index 14ba9c8e9dcfcf6a3242944cc266beb7e8f65346..bfab20c42c8f49feee9ee64c444956ba50664cef 100644 (file)
@@ -244,11 +244,9 @@ ExprType ClassifyExpression(Value *Expr) {
   case Value::ArgumentVal:              // nothing known, return variable itself
     return Expr;
   case Value::ConstantVal:              // Constant value, just return constant
-    Constant *CPV = cast<Constant>(Expr);
-    if (CPV->getType()->isInteger()) { // It's an integral constant!
-      ConstantInt *CPI = cast<ConstantInt>(Expr);
+    if (ConstantInt *CPI = dyn_cast<ConstantInt>(cast<Constant>(Expr)))
+      // It's an integral constant!
       return ExprType(CPI->isNullValue() ? 0 : CPI);
-    }
     return Expr;
   }