[llvm-commits] [llvm] r154305 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Craig Topper
craig.topper at gmail.com
Sun Apr 8 22:16:56 PDT 2012
Author: ctopper
Date: Mon Apr 9 00:16:56 2012
New Revision: 154305
URL: http://llvm.org/viewvc/llvm-project?rev=154305&view=rev
Log:
Replace some explicit checks with asserts for conditions that should never happen.
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=154305&r1=154304&r2=154305&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Apr 9 00:16:56 2012
@@ -7698,8 +7698,7 @@
SDValue N0 = N->getOperand(0);
SDValue N1 = N->getOperand(1);
- assert(N0.getValueType().getVectorNumElements() == NumElts &&
- "Vector shuffle must be normalized in DAG");
+ assert(N0.getValueType() == VT && "Vector shuffle must be normalized in DAG");
// Canonicalize shuffle undef, undef -> undef
if (N0.getOpcode() == ISD::UNDEF && N1.getOpcode() == ISD::UNDEF)
@@ -7804,27 +7803,21 @@
if (N0.getOperand(1).getOpcode() != ISD::UNDEF)
return SDValue();
- // The incoming shuffle must be of the same type as the result of the current
- // shuffle.
- if (OtherSV->getOperand(0).getValueType() != VT)
- return SDValue();
-
- EVT InVT = N0.getValueType();
- int InNumElts = InVT.getVectorNumElements();
+ // The incoming shuffle must be of the same type as the result of the
+ // current shuffle.
+ assert(OtherSV->getOperand(0).getValueType() == VT &&
+ "Shuffle types don't match");
for (unsigned i = 0; i != NumElts; ++i) {
int Idx = SVN->getMaskElt(i);
- // If we access the second (undef) operand then this index can be
- // canonicalized to undef as well.
- if (Idx >= InNumElts)
- Idx = -1;
+ assert(Idx < (int)NumElts && "Index references undef operand");
// Next, this index comes from the first value, which is the incoming
// shuffle. Adopt the incoming index.
if (Idx >= 0)
Idx = OtherSV->getMaskElt(Idx);
// The combined shuffle must map each index to itself.
- if ((unsigned)Idx != i && Idx != -1)
+ if (Idx >= 0 && (unsigned)Idx != i)
return SDValue();
}
More information about the llvm-commits
mailing list