diff options
author | Dale Johannesen <dalej@apple.com> | 2008-11-04 20:54:03 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2008-11-04 20:54:03 +0000 |
commit | c0bc547c99bd97088e950b3074d917091abe3f51 (patch) | |
tree | df3e0c8489472c46cf589e988235e7ed02090e1e | |
parent | 53997b07451a28582a8bb55716e13fc1bcd5c838 (diff) | |
download | external_llvm-c0bc547c99bd97088e950b3074d917091abe3f51.zip external_llvm-c0bc547c99bd97088e950b3074d917091abe3f51.tar.gz external_llvm-c0bc547c99bd97088e950b3074d917091abe3f51.tar.bz2 |
Allow SROA of vectors. Removing this caused a
huge performance regression in something we care
about. This may not be final fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58718 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/ScalarReplAggregates.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index b319d8d..309512b 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -531,8 +531,6 @@ void SROA::isSafeUseOfAllocation(Instruction *User, AllocationInst *AI, } } - bool hasVector = false; - // Walk through the GEP type indices, checking the types that this indexes // into. for (; I != E; ++I) { @@ -551,19 +549,13 @@ void SROA::isSafeUseOfAllocation(Instruction *User, AllocationInst *AI, // integer. Specifically, consider A[0][i]. We cannot know that the user // isn't doing invalid things like allowing i to index an out-of-range // subscript that accesses A[1]. Because of this, we have to reject SROA - // of any accesses into structs where any of the components are variables. + // of any accesses into structs where any of the components are variables. if (IdxVal->getZExtValue() >= AT->getNumElements()) return MarkUnsafe(Info); + } else if (const VectorType *VT = dyn_cast<VectorType>(*I)) { + if (IdxVal->getZExtValue() >= VT->getNumElements()) + return MarkUnsafe(Info); } - - // Note if we've seen a vector type yet - hasVector |= isa<VectorType>(*I); - - // Don't SROA pointers into vectors, unless all indices are zero. When all - // indices are zero, we only consider this GEP as a bitcast, but will still - // not consider breaking up the vector. - if (hasVector && !IsAllZeroIndices) - return MarkUnsafe(Info); } // If there are any non-simple uses of this getelementptr, make sure to reject |