From eee9312a85c020f90beb186fe95835e36ae8ce1c Mon Sep 17 00:00:00 2001 From: Stanislav Mekhanoshin Date: Thu, 1 Aug 2019 22:18:56 +0000 Subject: Relax load store vectorizer pointer strip checks The previous change to fix crash in the vectorizer introduced performance regressions. The condition to preserve pointer address space during the search is too tight, we only need to match the size. Differential Revision: https://reviews.llvm.org/D65600 llvm-svn: 367624 --- llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp') diff --git a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp index f799a45f567..19afe4157dc 100644 --- a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp @@ -339,14 +339,13 @@ bool Vectorizer::areConsecutivePointers(Value *PtrA, Value *PtrB, const APInt &PtrDelta, unsigned Depth) const { unsigned PtrBitWidth = DL.getPointerTypeSizeInBits(PtrA->getType()); - unsigned PtrAS = PtrA->getType()->getPointerAddressSpace(); APInt OffsetA(PtrBitWidth, 0); APInt OffsetB(PtrBitWidth, 0); PtrA = PtrA->stripAndAccumulateInBoundsConstantOffsets(DL, OffsetA); PtrB = PtrB->stripAndAccumulateInBoundsConstantOffsets(DL, OffsetB); - if (PtrA->getType()->getPointerAddressSpace() != PtrAS || - PtrB->getType()->getPointerAddressSpace() != PtrAS) + if (DL.getTypeStoreSizeInBits(PtrA->getType()) != PtrBitWidth || + DL.getTypeStoreSizeInBits(PtrB->getType()) != PtrBitWidth) return false; APInt OffsetDelta = OffsetB - OffsetA; -- cgit v1.2.3