]> granicus.if.org Git - clang/commitdiff
use more efficient type comparison predicates.
authorChris Lattner <sabre@nondot.org>
Sat, 26 Jun 2010 21:52:32 +0000 (21:52 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 26 Jun 2010 21:52:32 +0000 (21:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106958 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGExprConstant.cpp
lib/CodeGen/CGExprScalar.cpp
lib/CodeGen/TargetInfo.cpp

index 5e84ffc06dc0f52754c1247fa1cc2a01ef37ef25..1484334edc0c6f0378dfade26a1688e6fe271118 100644 (file)
@@ -427,7 +427,7 @@ EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
       NextVal = Builder.CreateGEP(NextVal, Inc, "ptrincdec");
       NextVal = Builder.CreateBitCast(NextVal, InVal->getType());
     }
-  } else if (InVal->getType() == llvm::Type::getInt1Ty(VMContext) && isInc) {
+  } else if (InVal->getType()->isIntegerTy(1) && isInc) {
     // Bool++ is an interesting case, due to promotion rules, we get:
     // Bool++ -> Bool = Bool+1 -> Bool = (int)Bool+1 ->
     // Bool = ((int)Bool+1) != 0
index a145a66b59b413ff4fc33c991f58daac35adef0b..d4c387796fe4a2f3bc2a43f37ed3390979afeaec 100644 (file)
@@ -908,7 +908,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
       llvm::Constant *C = llvm::ConstantInt::get(VMContext,
                                                  Result.Val.getInt());
 
-      if (C->getType() == llvm::Type::getInt1Ty(VMContext)) {
+      if (C->getType()->isIntegerTy(1)) {
         const llvm::Type *BoolTy = getTypes().ConvertTypeForMem(E->getType());
         C = llvm::ConstantExpr::getZExt(C, BoolTy);
       }
@@ -955,7 +955,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
   }
 
   llvm::Constant* C = ConstExprEmitter(*this, CGF).Visit(const_cast<Expr*>(E));
-  if (C && C->getType() == llvm::Type::getInt1Ty(VMContext)) {
+  if (C && C->getType()->isIntegerTy(1)) {
     const llvm::Type *BoolTy = getTypes().ConvertTypeForMem(E->getType());
     C = llvm::ConstantExpr::getZExt(C, BoolTy);
   }
index 773eb09bb6189191b29ba7627901b59f375ae98c..c5bc320727a67d55788fef43cafd5c059c522654 100644 (file)
@@ -1424,7 +1424,7 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) {
     return Builder.CreateAdd(Ops.LHS, Ops.RHS, "add");
   }
 
-  // Must have binary (not unary) expr here.  Unary pointer increment doesn't
+  // Must have binary (not unary) expr here.  Unary pointer decrement doesn't
   // use this path.
   const BinaryOperator *BinOp = cast<BinaryOperator>(Ops.E);
   
index 1de0ebc41c33383c826cc9a89eeb923a9eb55a67..667220063b614713f94fc0dafea8cbdacc05b7ea 100644 (file)
@@ -1076,7 +1076,7 @@ void X86_64ABIInfo::classify(QualType Ty,
 ABIArgInfo X86_64ABIInfo::getCoerceResult(QualType Ty,
                                           const llvm::Type *CoerceTo,
                                           ASTContext &Context) const {
-  if (CoerceTo == llvm::Type::getInt64Ty(CoerceTo->getContext())) {
+  if (CoerceTo->isIntegerTy(64)) {
     // Integer and pointer types will end up in a general purpose
     // register.
 
@@ -1087,7 +1087,7 @@ ABIArgInfo X86_64ABIInfo::getCoerceResult(QualType Ty,
     if (Ty->isIntegralOrEnumerationType() || Ty->hasPointerRepresentation())
       return (Ty->isPromotableIntegerType() ?
               ABIArgInfo::getExtend() : ABIArgInfo::getDirect());
-  } else if (CoerceTo == llvm::Type::getDoubleTy(CoerceTo->getContext())) {
+  } else if (CoerceTo->isDoubleTy()) {
     assert(Ty.isCanonical() && "should always have a canonical type here");
     assert(!Ty.hasQualifiers() && "should never have a qualified type here");