From: Chris Lattner Date: Wed, 21 Dec 2005 02:43:26 +0000 (+0000) Subject: Lower ConstantAggregateZero into zeros X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3b841e9f52611c1f92c60f979c775adf2c1fe22d;p=oota-llvm.git Lower ConstantAggregateZero into zeros git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24890 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index e6a0913a9b5..d75e5013d55 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -306,16 +306,29 @@ public: // Constant or ConstantFP node onto the ops list for each element of // the packed constant. std::vector Ops; - for (unsigned i = 0; i < NumElements; ++i) { - const Constant *CEl = C->getOperand(i); + if (ConstantPacked *CP = dyn_cast(C)) { + if (MVT::isFloatingPoint(PVT)) { + for (unsigned i = 0; i != NumElements; ++i) { + const ConstantFP *El = cast(CP->getOperand(i)); + Ops.push_back(DAG.getConstantFP(El->getValue(), PVT)); + } + } else { + for (unsigned i = 0; i != NumElements; ++i) { + const ConstantIntegral *El = + cast(CP->getOperand(i)); + Ops.push_back(DAG.getConstant(El->getRawValue(), PVT)); + } + } + } else { + assert(isa(C) && "Unknown packed constant!"); + SDOperand Op; if (MVT::isFloatingPoint(PVT)) - Ops.push_back(DAG.getConstantFP(cast(CEl)->getValue(), - PVT)); + Op = DAG.getConstantFP(0, PVT); else - Ops.push_back( - DAG.getConstant(cast(CEl)->getRawValue(), - PVT)); + Op = DAG.getConstant(0, PVT); + Ops.assign(NumElements, Op); } + // Handle the case where we have a 1-element vector, in which // case we want to immediately turn it into a scalar constant. if (Ops.size() == 1) {