[llvm-commits] [llvm] r70372 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGNodes.h include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h

Chris Lattner clattner at apple.com
Tue Apr 28 23:13:02 PDT 2009


On Apr 28, 2009, at 10:20 PM, Nate Begeman wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=70372&view=rev
> Log:
> Implement review feedback for vector shuffle work.

Very nice!

> bool ShuffleVectorSDNode::isSplatMask(const int *Mask, MVT VT) {
> -  int Idx = -1;
> -  for (unsigned i = 0, e = VT.getVectorNumElements(); i != e; ++i) {
> -    if (Idx < 0) Idx = Mask[i];
> +  // Find the first non-undef value in the shuffle mask.
> +  unsigned i, e;
> +  for (i = 0, e = VT.getVectorNumElements(); i != e && Mask[i] < 0;  
> ++i)
> +    /* search */;
> +
> +  // If we hit the end of the mask looking for a non-undef value,  
> return false.
> +  if (i == e)
> +    return false;

Is this even possible?  Since shuffle mask elements are immutable once  
a node is created, and the getShuffle method checks for this, I think  
this is impossible.  This can be an assert.

-Chris




More information about the llvm-commits mailing list