diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-06-26 19:31:26 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-06-26 19:31:26 +0000 |
| commit | 74e2acfcddf77cab40b71105eb8fb764c79adc97 (patch) | |
| tree | 76793cdb3fe153462bc02c5b7a86f1d8a190efe5 | |
| parent | f11b67bb8f3e077e2cc682b17019fec21184629d (diff) | |
| download | bcm5719-llvm-74e2acfcddf77cab40b71105eb8fb764c79adc97.tar.gz bcm5719-llvm-74e2acfcddf77cab40b71105eb8fb764c79adc97.zip | |
Simplify code
llvm-svn: 14424
| -rw-r--r-- | llvm/lib/Analysis/Expressions.cpp | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/llvm/lib/Analysis/Expressions.cpp b/llvm/lib/Analysis/Expressions.cpp index f6bec7d1607..3be3d3b2a1a 100644 --- a/llvm/lib/Analysis/Expressions.cpp +++ b/llvm/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<Constant>(Expr)) { if (ConstantInt *CPI = dyn_cast<ConstantInt>(cast<Constant>(Expr))) // It's an integral constant! return ExprType(CPI->isNullValue() ? 0 : CPI); return Expr; + } else if (!isa<Instruction>(Expr)) { + return Expr; } + Instruction *I = cast<Instruction>(Expr); const Type *Ty = I->getType(); |

