diff options
author | Diana Picus <diana.picus@linaro.org> | 2019-11-07 13:09:32 +0100 |
---|---|---|
committer | Diana Picus <diana.picus@linaro.org> | 2019-11-12 12:27:09 +0100 |
commit | 7f1dcc8952e6a1a4ba918159ab86bd787d584930 (patch) | |
tree | b6e147fd030704f5cb71ba2d50f36fc9a8167874 /llvm/lib/Analysis | |
parent | 8794f6787685655223be8a029bf51a1565f7a231 (diff) | |
download | bcm5719-llvm-7f1dcc8952e6a1a4ba918159ab86bd787d584930.tar.gz bcm5719-llvm-7f1dcc8952e6a1a4ba918159ab86bd787d584930.zip |
[InstCombine] Skip scalable vectors in combineLoadToOperationType
Don't try to canonicalize loads to scalable vector types to loads
of integers.
This removes one assertion when trying to use a TypeSize as a parameter
to DataLayout::isLegalInteger. It does not handle the second part of the
function (which looks at bitcasts).
This patch also contains a NFC fix for Load Analysis, where a variable
initialization that would cause the same assertion is moved closer to
its use. This allows us to run the new test for InstCombine without
having to teach LocationSize to play nicely with scalable vectors.
Differential Revision: https://reviews.llvm.org/D70075
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/Loads.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp index 641e92eac78..3f03d53778f 100644 --- a/llvm/lib/Analysis/Loads.cpp +++ b/llvm/lib/Analysis/Loads.cpp @@ -383,10 +383,6 @@ Value *llvm::FindAvailablePtrLoadStore(Value *Ptr, Type *AccessTy, MaxInstsToScan = ~0U; const DataLayout &DL = ScanBB->getModule()->getDataLayout(); - - // Try to get the store size for the type. - auto AccessSize = LocationSize::precise(DL.getTypeStoreSize(AccessTy)); - Value *StrippedPtr = Ptr->stripPointerCasts(); while (ScanFrom != ScanBB->begin()) { @@ -425,6 +421,9 @@ Value *llvm::FindAvailablePtrLoadStore(Value *Ptr, Type *AccessTy, return LI; } + // Try to get the store size for the type. + auto AccessSize = LocationSize::precise(DL.getTypeStoreSize(AccessTy)); + if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) { Value *StorePtr = SI->getPointerOperand()->stripPointerCasts(); // If this is a store through Ptr, the value is available! |