Make vectorized floating-point comparisons work without crashing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76726 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index e58693a..4d31f99 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -1215,7 +1215,7 @@
     Value *LHS = Visit(E->getLHS());
     Value *RHS = Visit(E->getRHS());
     
-    if (LHS->getType()->isFloatingPoint()) {
+    if (LHS->getType()->isFPOrFPVector()) {
       Result = Builder.CreateFCmp((llvm::CmpInst::Predicate)FCmpOpc,
                                   LHS, RHS, "cmp");
     } else if (LHSTy->isSignedIntegerType()) {
diff --git a/test/CodeGen/ext-vector.c b/test/CodeGen/ext-vector.c
index 4739a66..6a246db 100644
--- a/test/CodeGen/ext-vector.c
+++ b/test/CodeGen/ext-vector.c
@@ -124,3 +124,17 @@
   cmp = a == b;
   cmp = a != b;
 }
+
+void test8(float4 *ap, float4 *bp, int c) {
+  float4 a = *ap;
+  float4 b = *bp;
+
+  // Vector comparisons.
+  int4 cmp;
+  cmp = a < b;
+  cmp = a <= b;
+  cmp = a < b;
+  cmp = a >= b;
+  cmp = a == b;
+  cmp = a != b;
+}