[llvm-commits] [llvm] r94990 - in /llvm/trunk/lib/CodeGen/SelectionDAG: DAGCombiner.cpp SelectionDAG.cpp
Mon Ping Wang
wangmp at apple.com
Mon Feb 1 14:16:34 PST 2010
Hi Duncan,
On Feb 1, 2010, at 11:20 AM, Duncan Sands wrote:
>
>> - if (InOp.getValueType() != EltVT)
>> - return DAG.getNode(ISD::TRUNCATE, InVec.getDebugLoc(), EltVT, InOp);
>> + EVT NVT = N->getValueType(0);
>> + if (InOp.getValueType() != NVT) {
>> + assert(InOp.getValueType().isInteger() && NVT.isInteger());
>> + if (NVT.getSizeInBits() > InOp.getValueType().getSizeInBits())
>> + return DAG.getNode(ISD::SIGN_EXTEND, InVec.getDebugLoc(), NVT, InOp);
>> + else
>> + return DAG.getNode(ISD::TRUNCATE, InVec.getDebugLoc(), NVT, InOp);
>> + }
>
> There is a special method for this: DAG.getSExtOrTrunc.
Fixed.
>
>> @@ -2765,7 +2765,7 @@
>> // operations are lowered to scalars.
>> if (N1.getOpcode() == ISD::INSERT_VECTOR_ELT) {
>> // If the indices are the same, return the inserted element.
>> - if (N1.getOperand(2) == N2)
>> + if (N1.getOperand(2) == N2 && VT == N1.getOperand(1).getValueType())
>> return N1.getOperand(1);
>> // If the indices are known different, extract the element from
>> // the original vector.
>
> Why not just extend/truncate here too?
>
Fixed.
Thanks,
-- Mon Ping
More information about the llvm-commits
mailing list