From 32f6209ea9a5a88ad3f8d7ad5e5b160b403d12da Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Sun, 11 Jan 2009 23:22:37 +0000 Subject: make ScalarExprEmitter::EmitCompare() emit the expression with the correct type instead of always zext it to an int this fixes codegen of simple exprs in C++ like 'if (x != 0)' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62060 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprScalar.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/CGExprScalar.cpp') diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 7b71d7b129..4bb5fd1a4f 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -1021,9 +1021,8 @@ Value *ScalarExprEmitter::EmitCompare(const BinaryOperator *E,unsigned UICmpOpc, Result = Builder.CreateOr(ResultR, ResultI, "or.ri"); } } - - // ZExt result to int. - return Builder.CreateZExt(Result, CGF.LLVMIntTy, "cmp.ext"); + + return EmitScalarConversion(Result, CGF.getContext().BoolTy, E->getType()); } Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) { -- cgit v1.2.3