Minor simplification: use ShuffleVectorInst::getMaskValue instead of a more expensive helper.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142672 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eli Friedman 2011-10-21 19:11:34 +00:00
parent d2822e7572
commit 8d992f5c2c

View File

@ -108,7 +108,7 @@ static Value *FindScalarElement(Value *V, unsigned EltNo) {
if (ShuffleVectorInst *SVI = dyn_cast<ShuffleVectorInst>(V)) {
unsigned LHSWidth =
cast<VectorType>(SVI->getOperand(0)->getType())->getNumElements();
int InEl = getShuffleMask(SVI)[EltNo];
int InEl = SVI->getMaskValue(EltNo);
if (InEl < 0)
return UndefValue::get(PTy->getElementType());
if (InEl < (int)LHSWidth)
@ -212,7 +212,7 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
// If this is extracting an element from a shufflevector, figure out where
// it came from and extract from the appropriate input element instead.
if (ConstantInt *Elt = dyn_cast<ConstantInt>(EI.getOperand(1))) {
int SrcIdx = getShuffleMask(SVI)[Elt->getZExtValue()];
int SrcIdx = SVI->getMaskValue(Elt->getZExtValue());
Value *Src;
unsigned LHSWidth =
cast<VectorType>(SVI->getOperand(0)->getType())->getNumElements();