Remove some dead code and tidy things up now that vectors use ConstantDataVector

instead of always using ConstantVector.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149912 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2012-02-06 21:56:39 +00:00
parent 705f4813af
commit 7302d80490
9 changed files with 40 additions and 129 deletions

View File

@@ -1421,16 +1421,15 @@ static Instruction *OptimizeVectorResize(Value *InVal, VectorType *DestTy,
// Now that the element types match, get the shuffle mask and RHS of the
// shuffle to use, which depends on whether we're increasing or decreasing the
// size of the input.
SmallVector<Constant*, 16> ShuffleMask;
SmallVector<uint32_t, 16> ShuffleMask;
Value *V2;
IntegerType *Int32Ty = Type::getInt32Ty(SrcTy->getContext());
if (SrcTy->getNumElements() > DestTy->getNumElements()) {
// If we're shrinking the number of elements, just shuffle in the low
// elements from the input and use undef as the second shuffle input.
V2 = UndefValue::get(SrcTy);
for (unsigned i = 0, e = DestTy->getNumElements(); i != e; ++i)
ShuffleMask.push_back(ConstantInt::get(Int32Ty, i));
ShuffleMask.push_back(i);
} else {
// If we're increasing the number of elements, shuffle in all of the
@@ -1439,14 +1438,16 @@ static Instruction *OptimizeVectorResize(Value *InVal, VectorType *DestTy,
V2 = Constant::getNullValue(SrcTy);
unsigned SrcElts = SrcTy->getNumElements();
for (unsigned i = 0, e = SrcElts; i != e; ++i)
ShuffleMask.push_back(ConstantInt::get(Int32Ty, i));
ShuffleMask.push_back(i);
// The excess elements reference the first element of the zero input.
ShuffleMask.append(DestTy->getNumElements()-SrcElts,
ConstantInt::get(Int32Ty, SrcElts));
for (unsigned i = 0, e = DestTy->getNumElements()-SrcElts; i != e; ++i)
ShuffleMask.push_back(SrcElts);
}
return new ShuffleVectorInst(InVal, V2, ConstantVector::get(ShuffleMask));
return new ShuffleVectorInst(InVal, V2,
ConstantDataVector::get(V2->getContext(),
ShuffleMask));
}
static bool isMultipleOfTypeSize(unsigned Value, Type *Ty) {