From dee5f7522192fce1da00649c811e234bad05dd43 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 16 Apr 2003 22:50:19 +0000 Subject: [PATCH] Fix bug: IndVarSimplify/2003-04-16-ExprAnalysis.ll llvm-svn: 5795 --- llvm/lib/Analysis/Expressions.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Analysis/Expressions.cpp b/llvm/lib/Analysis/Expressions.cpp index 14ba9c8e9dcf..bfab20c42c8f 100644 --- a/llvm/lib/Analysis/Expressions.cpp +++ b/llvm/lib/Analysis/Expressions.cpp @@ -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(Expr); - if (CPV->getType()->isInteger()) { // It's an integral constant! - ConstantInt *CPI = cast(Expr); + if (ConstantInt *CPI = dyn_cast(cast(Expr))) + // It's an integral constant! return ExprType(CPI->isNullValue() ? 0 : CPI); - } return Expr; }