[llvm-commits] [llvm] r43470 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/bitcast-int-to-vector.ll

Dan Gohman djg at cray.com
Mon Oct 29 13:44:42 PDT 2007


Author: djg
Date: Mon Oct 29 15:44:42 2007
New Revision: 43470

URL: http://llvm.org/viewvc/llvm-project?rev=43470&view=rev
Log:
Fix a DAGCombiner abort on a bitcast from a scalar to a vector.

Added:
    llvm/trunk/test/CodeGen/X86/bitcast-int-to-vector.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=43470&r1=43469&r2=43470&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Oct 29 15:44:42 2007
@@ -4212,7 +4212,8 @@
       unsigned NumElts = MVT::getVectorNumElements(VT);
       if (InVec.getOpcode() == ISD::BIT_CONVERT) {
         MVT::ValueType BCVT = InVec.getOperand(0).getValueType();
-        if (NumElts != MVT::getVectorNumElements(BCVT))
+        if (!MVT::isVector(BCVT) ||
+            NumElts != MVT::getVectorNumElements(BCVT))
           return SDOperand();
         InVec = InVec.getOperand(0);
         EVT = MVT::getVectorElementType(BCVT);

Added: llvm/trunk/test/CodeGen/X86/bitcast-int-to-vector.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/bitcast-int-to-vector.ll?rev=43470&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/X86/bitcast-int-to-vector.ll (added)
+++ llvm/trunk/test/CodeGen/X86/bitcast-int-to-vector.ll Mon Oct 29 15:44:42 2007
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | llc -march=x86
+
+define i1 @foo(i64 %a)
+{
+  %t = bitcast i64 %a to <2 x float>
+  %r = extractelement <2 x float> %t, i32 0
+  %s = extractelement <2 x float> %t, i32 1
+  %b = fcmp uno float %r, %s
+  ret i1 %b
+}





More information about the llvm-commits mailing list