From e6d1592492a3a379186bfb02bd0f4eda0669c0d5 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 20 Aug 2019 20:50:12 +0000 Subject: Vendor import of stripped llvm trunk r366426 (just before the release_90 branch point): https://llvm.org/svn/llvm-project/llvm/trunk@366426 --- lib/Transforms/Vectorize/LoadStoreVectorizer.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'lib/Transforms/Vectorize/LoadStoreVectorizer.cpp') diff --git a/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp index 9ff18328c219..4273080ddd91 100644 --- a/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp +++ b/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp @@ -1,9 +1,8 @@ //===- LoadStoreVectorizer.cpp - GPU Load & Store Vectorizer --------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -927,7 +926,7 @@ bool Vectorizer::vectorizeStoreChain( StoreInst *S0 = cast(Chain[0]); // If the vector has an int element, default to int for the whole store. - Type *StoreTy; + Type *StoreTy = nullptr; for (Instruction *I : Chain) { StoreTy = cast(I)->getValueOperand()->getType(); if (StoreTy->isIntOrIntVectorTy()) @@ -939,6 +938,7 @@ bool Vectorizer::vectorizeStoreChain( break; } } + assert(StoreTy && "Failed to find store type"); unsigned Sz = DL.getTypeSizeInBits(StoreTy); unsigned AS = S0->getPointerAddressSpace(); @@ -1152,13 +1152,8 @@ bool Vectorizer::vectorizeLoadChain( vectorizeLoadChain(Chains.second, InstructionsProcessed); } - unsigned NewAlign = getOrEnforceKnownAlignment(L0->getPointerOperand(), - StackAdjustedAlignment, - DL, L0, nullptr, &DT); - if (NewAlign != 0) - Alignment = NewAlign; - - Alignment = NewAlign; + Alignment = getOrEnforceKnownAlignment( + L0->getPointerOperand(), StackAdjustedAlignment, DL, L0, nullptr, &DT); } if (!TTI.isLegalToVectorizeLoadChain(SzInBytes, Alignment, AS)) { @@ -1182,7 +1177,7 @@ bool Vectorizer::vectorizeLoadChain( Value *Bitcast = Builder.CreateBitCast(L0->getPointerOperand(), VecTy->getPointerTo(AS)); - LoadInst *LI = Builder.CreateAlignedLoad(Bitcast, Alignment); + LoadInst *LI = Builder.CreateAlignedLoad(VecTy, Bitcast, Alignment); propagateMetadata(LI, Chain); if (VecLoadTy) { -- cgit v1.2.3