[llvm-branch-commits] [llvm-branch] r86788 - in /llvm/branches/Apple/Leela: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/PowerPC/vec_auto_constant.ll

Dale Johannesen dalej at apple.com
Tue Nov 10 17:58:34 PST 2009


Author: johannes
Date: Tue Nov 10 19:58:33 2009
New Revision: 86788

URL: http://llvm.org/viewvc/llvm-project?rev=86788&view=rev
Log:
$ svn merge -c 86751 https://dalej@llvm.org/svn/llvm-project/llvm/trunk
--- Merging r86751 into '.':
A    test/CodeGen/PowerPC/vec_auto_constant.ll
U    lib/CodeGen/SelectionDAG/LegalizeDAG.cpp


Added:
    llvm/branches/Apple/Leela/test/CodeGen/PowerPC/vec_auto_constant.ll
      - copied unchanged from r86751, llvm/trunk/test/CodeGen/PowerPC/vec_auto_constant.ll
Modified:
    llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Modified: llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=86788&r1=86787&r2=86788&view=diff

==============================================================================
--- llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/branches/Apple/Leela/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Nov 10 19:58:33 2009
@@ -1810,10 +1810,19 @@
         CV.push_back(const_cast<ConstantFP *>(V->getConstantFPValue()));
       } else if (ConstantSDNode *V =
                  dyn_cast<ConstantSDNode>(Node->getOperand(i))) {
-        CV.push_back(const_cast<ConstantInt *>(V->getConstantIntValue()));
+        if (OpVT==EltVT)
+          CV.push_back(const_cast<ConstantInt *>(V->getConstantIntValue()));
+        else {
+          // If OpVT and EltVT don't match, EltVT is not legal and the
+          // element values have been promoted/truncated earlier.  Undo this;
+          // we don't want a v16i8 to become a v16i32 for example.
+          const ConstantInt *CI = V->getConstantIntValue();
+          CV.push_back(ConstantInt::get(EltVT.getTypeForEVT(*DAG.getContext()),
+                                        CI->getZExtValue()));
+        }
       } else {
         assert(Node->getOperand(i).getOpcode() == ISD::UNDEF);
-        const Type *OpNTy = OpVT.getTypeForEVT(*DAG.getContext());
+        const Type *OpNTy = EltVT.getTypeForEVT(*DAG.getContext());
         CV.push_back(UndefValue::get(OpNTy));
       }
     }





More information about the llvm-branch-commits mailing list