diff --git a/include/llvm/IR/Instructions.h b/include/llvm/IR/Instructions.h index 49b7d472a57..da694f664d9 100644 --- a/include/llvm/IR/Instructions.h +++ b/include/llvm/IR/Instructions.h @@ -2160,19 +2160,22 @@ public: return cast(getOperand(2)); } - /// Return the index from the shuffle mask for the specified - /// output result. This is either -1 if the element is undef or a number less - /// than 2*numelements. - static int getMaskValue(Constant *Mask, unsigned i); + /// Return the shuffle mask value for the specified element of the mask. + /// Return -1 if the element is undef. + static int getMaskValue(Constant *Mask, unsigned Elt); - int getMaskValue(unsigned i) const { - return getMaskValue(getMask(), i); + /// Return the shuffle mask value of this instruction for the given element + /// index. Return -1 if the element is undef. + int getMaskValue(unsigned Elt) const { + return getMaskValue(getMask(), Elt); } - /// Return the full mask for this instruction, where each - /// element is the element number and undef's are returned as -1. + /// Convert the input shuffle mask operand to a vector of integers. Undefined + /// elements of the mask are returned as -1. static void getShuffleMask(Constant *Mask, SmallVectorImpl &Result); + /// Return the mask for this instruction as a vector of integers. Undefined + /// elements of the mask are returned as -1. void getShuffleMask(SmallVectorImpl &Result) const { return getShuffleMask(getMask(), Result); } diff --git a/lib/IR/Instructions.cpp b/lib/IR/Instructions.cpp index 5355f1a617a..89c2caf0dbb 100644 --- a/lib/IR/Instructions.cpp +++ b/lib/IR/Instructions.cpp @@ -1908,9 +1908,6 @@ bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2, return false; } -/// getMaskValue - Return the index from the shuffle mask for the specified -/// output result. This is either -1 if the element is undef or a number less -/// than 2*numelements. int ShuffleVectorInst::getMaskValue(Constant *Mask, unsigned i) { assert(i < Mask->getType()->getVectorNumElements() && "Index out of range"); if (ConstantDataSequential *CDS =dyn_cast(Mask)) @@ -1921,8 +1918,6 @@ int ShuffleVectorInst::getMaskValue(Constant *Mask, unsigned i) { return cast(C)->getZExtValue(); } -/// getShuffleMask - Return the full mask for this instruction, where each -/// element is the element number and undef's are returned as -1. void ShuffleVectorInst::getShuffleMask(Constant *Mask, SmallVectorImpl &Result) { unsigned NumElts = Mask->getType()->getVectorNumElements();