diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-26 22:37:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-26 22:37:01 +0000 |
commit | 9619662a1d42e2008b865d3459c0677e149dad1b (patch) | |
tree | 0714b13525e4c45644753ff246259e78f6775fd5 /lib/CodeGen/CGExprScalar.cpp | |
parent | 8b51fd76319d8b71f401cc6ad56e6f4f7be77958 (diff) |
remove uses of QualType::getCanonicalType() from codegen for PR2189
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index da8350b19f..c44af4b8f1 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -345,8 +345,8 @@ Value *ScalarExprEmitter::EmitConversionToBool(Value *Src, QualType SrcType) { /// specified destination type, both of which are LLVM scalar types. Value *ScalarExprEmitter::EmitScalarConversion(Value *Src, QualType SrcType, QualType DstType) { - SrcType = SrcType.getCanonicalType(); - DstType = DstType.getCanonicalType(); + SrcType = CGF.getContext().getCanonicalType(SrcType); + DstType = CGF.getContext().getCanonicalType(DstType); if (SrcType == DstType) return Src; if (DstType->isVoidType()) return 0; @@ -421,7 +421,7 @@ Value *ScalarExprEmitter:: EmitComplexToScalarConversion(CodeGenFunction::ComplexPairTy Src, QualType SrcTy, QualType DstTy) { // Get the source element type. - SrcTy = cast<ComplexType>(SrcTy.getCanonicalType())->getElementType(); + SrcTy = SrcTy->getAsComplexType()->getElementType(); // Handle conversions to bool first, they are special: comparisons against 0. if (DstTy->isBooleanType()) { @@ -546,10 +546,6 @@ Value *ScalarExprEmitter::VisitImplicitCastExpr(const ImplicitCastExpr *E) { return V; } else if (E->getType()->isReferenceType()) { - assert(cast<ReferenceType>(E->getType().getCanonicalType())-> - getPointeeType() == - Op->getType().getCanonicalType() && "Incompatible types!"); - return EmitLValue(Op).getAddress(); } @@ -819,7 +815,7 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) { // Zero or sign extend the pointer value based on whether the index is // signed or not. const llvm::Type *IdxType = llvm::IntegerType::get(CGF.LLVMPointerWidth); - if (IdxExp->getType().getCanonicalType()->isSignedIntegerType()) + if (IdxExp->getType()->isSignedIntegerType()) Idx = Builder.CreateSExt(Idx, IdxType, "idx.ext"); else Idx = Builder.CreateZExt(Idx, IdxType, "idx.ext"); @@ -843,7 +839,7 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &Ops) { // Zero or sign extend the pointer value based on whether the index is // signed or not. const llvm::Type *IdxType = llvm::IntegerType::get(CGF.LLVMPointerWidth); - if (Ops.E->getRHS()->getType().getCanonicalType()->isSignedIntegerType()) + if (Ops.E->getRHS()->getType()->isSignedIntegerType()) Idx = Builder.CreateSExt(Idx, IdxType, "idx.ext"); else Idx = Builder.CreateZExt(Idx, IdxType, "idx.ext"); @@ -862,8 +858,8 @@ Value *ScalarExprEmitter::VisitBinSub(const BinaryOperator *E) { Value *LHS = Visit(E->getLHS()); Value *RHS = Visit(E->getRHS()); - const QualType LHSType = E->getLHS()->getType().getCanonicalType(); - const QualType LHSElementType = cast<PointerType>(LHSType)->getPointeeType(); + const QualType LHSType = E->getLHS()->getType(); + const QualType LHSElementType = LHSType->getAsPointerType()->getPointeeType(); uint64_t ElementSize = CGF.getContext().getTypeSize(LHSElementType) / 8; const llvm::Type *ResultType = ConvertType(E->getType()); @@ -948,8 +944,7 @@ Value *ScalarExprEmitter::EmitCompare(const BinaryOperator *E,unsigned UICmpOpc, CodeGenFunction::ComplexPairTy LHS = CGF.EmitComplexExpr(E->getLHS()); CodeGenFunction::ComplexPairTy RHS = CGF.EmitComplexExpr(E->getRHS()); - QualType CETy = - cast<ComplexType>(LHSTy.getCanonicalType())->getElementType(); + QualType CETy = LHSTy->getAsComplexType()->getElementType(); Value *ResultR, *ResultI; if (CETy->isRealFloatingType()) { |