LoadStoreVectorizer: if one element of a vector is integer, default to

integer.

Fixes issues on some architectures where we use arithmetic ops to build
vectors, which can cause bad things to happen for loads/stores of mixed
types.

Patch by Fiona Glaser

llvm-svn: 274307
This commit is contained in:
Matt Arsenault
2016-07-01 00:37:01 +00:00
parent 8a4ab5e19f
commit d7e8898bdd
2 changed files with 19 additions and 3 deletions

View File

@@ -579,7 +579,15 @@ bool Vectorizer::vectorizeInstructions(ArrayRef<Value *> Instrs) {
bool Vectorizer::vectorizeStoreChain(ArrayRef<Value *> Chain) {
StoreInst *S0 = cast<StoreInst>(Chain[0]);
Type *StoreTy = S0->getValueOperand()->getType();
// If the vector has an int element, default to int for the whole load.
Type *StoreTy;
for (const auto &V : Chain) {
StoreTy = cast<StoreInst>(V)->getValueOperand()->getType();
if (StoreTy->isIntOrIntVectorTy())
break;
}
unsigned Sz = DL.getTypeSizeInBits(StoreTy);
unsigned VF = VecRegSize / Sz;
unsigned ChainSize = Chain.size();
@@ -700,7 +708,15 @@ bool Vectorizer::vectorizeStoreChain(ArrayRef<Value *> Chain) {
bool Vectorizer::vectorizeLoadChain(ArrayRef<Value *> Chain) {
LoadInst *L0 = cast<LoadInst>(Chain[0]);
Type *LoadTy = L0->getType();
// If the vector has an int element, default to int for the whole load.
Type *LoadTy;
for (const auto &V : Chain) {
LoadTy = cast<LoadInst>(V)->getType();
if (LoadTy->isIntOrIntVectorTy())
break;
}
unsigned Sz = DL.getTypeSizeInBits(LoadTy);
unsigned VF = VecRegSize / Sz;
unsigned ChainSize = Chain.size();