diff options
-rw-r--r-- | lib/Transforms/Scalar/ScalarReplAggregates.cpp | 5 | ||||
-rw-r--r-- | test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 9f286b5642..09e597fe66 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -342,7 +342,10 @@ void ConvertToScalarInfo::MergeInType(const Type *In, uint64_t Offset, // If we're accessing something that could be an element of a vector, see // if the implied vector agrees with what we already have and if Offset is // compatible with it. - if (Offset % EltSize == 0 && AllocaSize % EltSize == 0) { + if (Offset % EltSize == 0 && AllocaSize % EltSize == 0 && + Offset * 8 < + (VectorTy ? VectorTy->getPrimitiveSizeInBits() + : (AllocaSize / EltSize) * In->getPrimitiveSizeInBits())) { if (!VectorTy) { VectorTy = VectorType::get(In, AllocaSize/EltSize); return; diff --git a/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll b/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll index 0b008f48db..32e67fbce7 100644 --- a/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll +++ b/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll @@ -41,9 +41,11 @@ entry: ; CHECK: test2 ; CHECK-NOT: alloca -; CHECK: insertelement <2 x float> zeroinitializer -; CHECK: extractelement <2 x float> %tmp2 -; CHECK: extractelement <2 x float> %tmp2 +; CHECK: and i128 +; CHECK: or i128 +; CHECK: trunc i128 +; CHECK-NOT: insertelement +; CHECK-NOT: extractelement define float @test2() uwtable ssp { entry: |