From: Chris Lattner Date: Sat, 26 Jun 2010 21:52:32 +0000 (+0000) Subject: use more efficient type comparison predicates. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f215c12af4c3e7f81b24102a676aabfdb4e1566;p=clang use more efficient type comparison predicates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106958 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 5e84ffc06d..1484334edc 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -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 diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index a145a66b59..d4c387796f 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -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(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); } diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 773eb09bb6..c5bc320727 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -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(Ops.E); diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index 1de0ebc41c..667220063b 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -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");