aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/CGExprScalar.cpp5
-rw-r--r--test/CodeGenCXX/expr.cpp5
2 files changed, 7 insertions, 3 deletions
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) {
diff --git a/test/CodeGenCXX/expr.cpp b/test/CodeGenCXX/expr.cpp
new file mode 100644
index 0000000000..5b8efacdd7
--- /dev/null
+++ b/test/CodeGenCXX/expr.cpp
@@ -0,0 +1,5 @@
+// RUN: clang -emit-llvm -x c++ < %s
+
+void f(int x) {
+ if (x != 0) return;
+}