[llvm-commits] [llvm] r42264 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/X86/extractelement-from-arg.ll

Dan Gohman djg at cray.com
Mon Sep 24 08:54:54 PDT 2007


Author: djg
Date: Mon Sep 24 10:54:53 2007
New Revision: 42264

URL: http://llvm.org/viewvc/llvm-project?rev=42264&view=rev
Log:
Use the correct result value type instead of using getValueType(0)
in ExpandEXTRACT_VECTOR_ELT and SplitVectorOp. This fixes an abort
in the included testcase.

Added:
    llvm/trunk/test/CodeGen/X86/extractelement-from-arg.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

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

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Sep 24 10:54:53 2007
@@ -3870,8 +3870,7 @@
   SDOperand Vec = Op.getOperand(0);
   SDOperand Idx = Op.getOperand(1);
   
-  SDNode *InVal = Vec.Val;
-  MVT::ValueType TVT = InVal->getValueType(0);
+  MVT::ValueType TVT = Vec.getValueType();
   unsigned NumElems = MVT::getVectorNumElements(TVT);
   
   switch (TLI.getOperationAction(ISD::EXTRACT_VECTOR_ELT, TVT)) {
@@ -5803,10 +5802,10 @@
                                          SDOperand &Hi) {
   assert(MVT::isVector(Op.getValueType()) && "Cannot split non-vector type!");
   SDNode *Node = Op.Val;
-  unsigned NumElements = MVT::getVectorNumElements(Node->getValueType(0));
+  unsigned NumElements = MVT::getVectorNumElements(Op.getValueType());
   assert(NumElements > 1 && "Cannot split a single element vector!");
   unsigned NewNumElts = NumElements/2;
-  MVT::ValueType NewEltVT = MVT::getVectorElementType(Node->getValueType(0));
+  MVT::ValueType NewEltVT = MVT::getVectorElementType(Op.getValueType());
   MVT::ValueType NewVT = MVT::getVectorType(NewEltVT, NewNumElts);
   
   // See if we already split it.

Added: llvm/trunk/test/CodeGen/X86/extractelement-from-arg.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/extractelement-from-arg.ll?rev=42264&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/X86/extractelement-from-arg.ll (added)
+++ llvm/trunk/test/CodeGen/X86/extractelement-from-arg.ll Mon Sep 24 10:54:53 2007
@@ -0,0 +1,7 @@
+; RUN: llvm-as %s -o - | llc -march=x86-64
+
+define void @test(float* %R, <4 x float> %X) {
+	%tmp = extractelement <4 x float> %X, i32 3
+	store float %tmp, float* %R
+	ret void
+}





More information about the llvm-commits mailing list