From: Chris Lattner Date: Sat, 26 Jun 2004 19:31:26 +0000 (+0000) Subject: Simplify code X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=af754dbf65cffbd5d618a3a72087fe2e7908d01f;p=oota-llvm.git Simplify code git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14424 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/Expressions.cpp b/lib/Analysis/Expressions.cpp index f6bec7d1607..3be3d3b2a1a 100644 --- a/lib/Analysis/Expressions.cpp +++ b/lib/Analysis/Expressions.cpp @@ -243,25 +243,18 @@ static inline ExprType negate(const ExprType &E, Value *V) { // ExprType llvm::ClassifyExpr(Value *Expr) { assert(Expr != 0 && "Can't classify a null expression!"); - if (Expr->getType() == Type::FloatTy || Expr->getType() == Type::DoubleTy) + if (Expr->getType()->isFloatingPoint()) return Expr; // FIXME: Can't handle FP expressions - switch (Expr->getValueType()) { - case Value::InstructionVal: break; // Instruction... hmmm... investigate. - case Value::TypeVal: case Value::BasicBlockVal: - case Value::FunctionVal: default: - //assert(0 && "Unexpected expression type to classify!"); - std::cerr << "Bizarre thing to expr classify: " << Expr << "\n"; - return Expr; - case Value::GlobalVariableVal: // Global Variable & Function argument: - case Value::ArgumentVal: // nothing known, return variable itself - return Expr; - case Value::ConstantVal: // Constant value, just return constant + if (Constant *C = dyn_cast(Expr)) { if (ConstantInt *CPI = dyn_cast(cast(Expr))) // It's an integral constant! return ExprType(CPI->isNullValue() ? 0 : CPI); return Expr; + } else if (!isa(Expr)) { + return Expr; } + Instruction *I = cast(Expr); const Type *Ty = I->getType();