Start using the new function cloning header
[oota-llvm.git] / lib / Analysis / Expressions.cpp
index f4f76af4c9977d0c3bed14aec25f89fd746b813d..14ba9c8e9dcfcf6a3242944cc266beb7e8f65346 100644 (file)
 #include "llvm/Analysis/Expressions.h"
 #include "llvm/ConstantHandling.h"
 #include "llvm/Function.h"
-#include "llvm/BasicBlock.h"
-#include "llvm/Instruction.h"
-#include <iostream>
-
-using namespace analysis;
 
 ExprType::ExprType(Value *Val) {
   if (Val) 
@@ -35,7 +30,7 @@ ExprType::ExprType(const ConstantInt *scale, Value *var,
                   const ConstantInt *offset) {
   Scale = var ? scale : 0; Var = var; Offset = offset;
   ExprTy = Scale ? ScaledLinear : (Var ? Linear : Constant);
-  if (Scale && Scale->equalsInt(0)) {  // Simplify 0*Var + const
+  if (Scale && Scale->isNullValue()) {  // Simplify 0*Var + const
     Scale = 0; Var = 0;
     ExprTy = Constant;
   }
@@ -233,7 +228,7 @@ static inline ExprType negate(const ExprType &E, Value *V) {
 // Note that this analysis cannot get into infinite loops because it treats PHI
 // nodes as being an unknown linear expression.
 //
-ExprType analysis::ClassifyExpression(Value *Expr) {
+ExprType ClassifyExpression(Value *Expr) {
   assert(Expr != 0 && "Can't classify a null expression!");
   if (Expr->getType() == Type::FloatTy || Expr->getType() == Type::DoubleTy)
     return Expr;   // FIXME: Can't handle FP expressions
@@ -250,9 +245,9 @@ ExprType analysis::ClassifyExpression(Value *Expr) {
     return Expr;
   case Value::ConstantVal:              // Constant value, just return constant
     Constant *CPV = cast<Constant>(Expr);
-    if (CPV->getType()->isIntegral()) { // It's an integral constant!
+    if (CPV->getType()->isInteger()) { // It's an integral constant!
       ConstantInt *CPI = cast<ConstantInt>(Expr);
-      return ExprType(CPI->equalsInt(0) ? 0 : CPI);
+      return ExprType(CPI->isNullValue() ? 0 : CPI);
     }
     return Expr;
   }