Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1663,10 +1663,13 @@ class ShuffleVectorSDNode : public SDNode {

bool isSplat() const { return isSplatMask(getMask()); }

int getSplatIndex() const {
assert(isSplat() && "Cannot get splat index for non-splat!");
EVT VT = getValueType(0);
for (unsigned i = 0, e = VT.getVectorNumElements(); i != e; ++i)
int getSplatIndex() const { return getSplatMaskIndex(getMask()); }

static bool isSplatMask(ArrayRef<int> Mask);

static int getSplatMaskIndex(ArrayRef<int> Mask) {
assert(isSplatMask(Mask) && "Cannot get splat index for non-splat!");
for (unsigned i = 0, e = Mask.size(); i != e; ++i)
if (Mask[i] >= 0)
return Mask[i];

Expand All @@ -1675,8 +1678,6 @@ class ShuffleVectorSDNode : public SDNode {
return 0;
}

static bool isSplatMask(ArrayRef<int> Mask);

/// Change values in a shuffle permute mask assuming
/// the two vector operands have swapped position.
static void commuteMask(MutableArrayRef<int> Mask) {
Expand Down